我想使用 iptables 创建一个自定义表,以便我可以在其中添加我的自定义链。但我没有看到任何选项可以做到这一点。我试图搜索它,但没有找到任何东西。请帮忙。
Lek*_*eyn 18
我认为您正在寻找创建链,而不是表。
-N, --new-chain chain
Create a new user-defined chain by the given name. There must be no target of that name already.
Run Code Online (Sandbox Code Playgroud)
示例(-t filter隐含):
iptables -N Services
iptables -A INPUT -j Services
iptables -A Services -m tcp -p tcp --dport 80 -j ACCEPT
Run Code Online (Sandbox Code Playgroud)
可以使用以下-t选项选择表格:
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
Run Code Online (Sandbox Code Playgroud)
如果您正在使用iptables-restore,则可以将上述两条规则组合为:
*nat
-A POSTROUTING -j MASQUERADE
COMMIT
*filter
:Services -
-A INPUT -j Services
-A Services -m tcp -p tcp --dport 80 -j ACCEPT
COMMIT
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
34324 次 |
| 最近记录: |