feat(*): update web page img
中文 English
iptables
ip6tables
iptables-save
注意:仅支持 Linux 系统,并需要具备对宿主机 iptables/ip6tables 的执行权限(root 或特权容器)。
--privileged --net=host
iptables-restore
go.mod
docker run -d \ --name iptables-web \ --privileged=true \ --net=host \ -e IPT_WEB_USERNAME=admin \ -e IPT_WEB_PASSWORD=admin \ -e IPT_WEB_ADDRESS=:10001 \ -p 10001:10001 \ pretty66/iptables-web:latest
IPT_WEB_ADDRESS
:10001
127.0.0.1:10001
git clone https://github.com/pretty66/iptables-web.git cd iptables-web make release # 需要 Go 环境 ./iptables-server -a :10001 -u admin -p admin
后台运行可结合 nohup、systemd、supervisor。Makefile 默认通过 -ldflags 注入构建版本信息。
nohup
systemd
supervisor
Makefile
-ldflags
-a
-u
IPT_WEB_USERNAME
admin
-p
IPT_WEB_PASSWORD
优先级:命令行 > 环境变量 > 默认值。所有接口使用 Basic Auth,请务必修改默认凭据,并建议在生产环境通过 HTTPS/反向代理加固。
启动成功后会输出:
listen address: :10001 Build Version: <commit> Date: <yyyy-mm-dd hh:mm:ss>
访问 http://<host>:10001,输入 Basic Auth 凭据即可进入界面。若日志提示缺少 ip6tables,说明宿主机未安装对应命令,可忽略或自行安装。
http://<host>:10001
raw/mangle/nat/filter
插入
iptables -t <table> -I <chain> ...
添加
iptables -t <table> -A <chain> ...
清零计数
iptables -Z
清空规则
iptables -F <chain>
刷新/查看命令
iptables-save/restore
所有接口均需 Basic Auth,可选 protocol 参数(ipv4/ipv6,默认 ipv4)。
protocol
ipv4
ipv6
/version
/listRule
table
chain
/listExec
/flushRule
/flushMetrics
id
/deleteRule
/getRuleInfo
/flushEmptyCustomChain
/export
/import
rule
/exec
args
iptables-web is under the Apache 2.0 license. See the LICENSE file for details.
mirror for https://github.com/pretty66/iptables-web
©Copyright 2023 CCF 开源发展委员会 Powered by Trustie& IntelliDE 京ICP备13000930号
iptables 管理程序
中文 English
iptables-web 是一个轻量级的 iptables/ip6tables Web 管理平台,集成前端界面与 REST API,单二进制即可部署,适合日常运维与学习使用。
目录
功能概览
iptables与ip6tables,页面/接口均可一键切换 IPv4/IPv6。iptables-save输出,随时校验规则。前置条件
--privileged --net=host。iptables、iptables-save、iptables-restore;IPv6 同理。go.mod为准)。安装部署
Docker(推荐)
--privileged --net=host让容器拥有修改宿主机防火墙的能力。IPT_WEB_ADDRESS默认为:10001,可改为127.0.0.1:10001限制访问范围。二进制部署
后台运行可结合
nohup、systemd、supervisor。Makefile默认通过-ldflags注入构建版本信息。配置项
-aIPT_WEB_ADDRESS:10001-uIPT_WEB_USERNAMEadmin-pIPT_WEB_PASSWORDadmin优先级:命令行 > 环境变量 > 默认值。所有接口使用 Basic Auth,请务必修改默认凭据,并建议在生产环境通过 HTTPS/反向代理加固。
运行与监控
启动成功后会输出:
访问
http://<host>:10001,输入 Basic Auth 凭据即可进入界面。若日志提示缺少ip6tables,说明宿主机未安装对应命令,可忽略或自行安装。Web 界面操作
raw/mangle/nat/filter,点击即可查看原生链与自定义链,还可通过右侧目录快速跳转。插入:执行iptables -t <table> -I <chain> ...。添加:执行iptables -t <table> -A <chain> ...。清零计数:iptables -Z针对链或单条规则。清空规则:iptables -F <chain>。刷新/查看命令:重新拉取链或显示iptables-save中对应语句。iptables-save/restore,导入文件以 0600 权限保存于临时目录)。REST 接口速查
所有接口均需 Basic Auth,可选
protocol参数(ipv4/ipv6,默认ipv4)。/version/listRuletable,chain/listExectable,chainiptables-save输出或包含指定链的行。/flushRuletable,chain/flushMetricstable,chain,idid为空表示整链/整表。/deleteRuletable,chain,id/getRuleInfotable,chain,idiptables-save中指定规则。/flushEmptyCustomChain/exporttable,chain/importrule/execargs常见问题
ip6tables或权限不足,可仅使用 IPv4。iptables-restore错误信息即可定位。附加文档
License
iptables-web is under the Apache 2.0 license. See the LICENSE file for details.