首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >删除特定的iptables规则

删除特定的iptables规则
EN

Stack Overflow用户
提问于 2013-11-19 11:06:07
回答 1查看 2.4K关注 0票数 3

我有以下的可依地规则,如果可能的话,需要帮助删除它吗?

代码语言:javascript
复制
iptables -t nat -I PREROUTING -p tcp --dport 12348 -j DNAT --to-destination 192.168.0.5:12348
iptables -t nat -I PREROUTING -p tcp --dport 7778 -j DNAT --to-destination 192.168.0.5:7778

我知道-D代表删除规则,但我不知道在我的命令中我打算把它放在哪里,

提前欢呼

更新的==>

iptables -L -t nat的输出:

代码语言:javascript
复制
Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination
DNAT       tcp  --  anywhere             anywhere            tcp dpt:interwise to:192.168.0.5:7778
DNAT       tcp  --  anywhere             anywhere            tcp dpt:12348 to:192.168.0.5:12348
DNAT       tcp  --  anywhere             anywhere            tcp dpt:7772 to:192.168.0.5:7772
DNAT       tcp  --  anywhere             anywhere            tcp dpt:12342 to:192.168.0.5:12342
DNAT       tcp  --  anywhere             anywhere            tcp dpt:interwise to:192.168.0.5:7778
DNAT       tcp  --  anywhere             anywhere            tcp dpt:12348 to:192.168.0.5:12348
DNAT       tcp  --  anywhere             anywhere            tcp dpt:12348 to:192.168.0.5:12348
DNAT       tcp  --  anywhere             anywhere            tcp dpt:12342 to:192.168.0.5:12342
DNAT       tcp  --  anywhere             anywhere            tcp dpt:7772 to:192.168.0.5:7772
DNAT       tcp  --  anywhere             anywhere            tcp dpt:interwise to:192.168.0.5:7778
DNAT       tcp  --  anywhere             anywhere            tcp dpt:vstat to:192.168.0.5:7779
DNAT       tcp  --  anywhere             anywhere            tcp dpt:12349 to:192.168.0.5:12349
DNAT       tcp  --  anywhere             anywhere            tcp dpt:imtc-map to:192.168.0.2:22
DNAT       tcp  --  anywhere             anywhere            tcp dpt:b2-runtime to:192.168.0.3:22
DNAT       tcp  --  anywhere             anywhere            tcp dpt:b2-license to:192.168.0.4:22
DNAT       tcp  --  anywhere             anywhere            tcp dpt:jps to:192.168.0.5:22
DNAT       tcp  --  anywhere             anywhere            tcp dpt:hpocbus to:192.168.0.6:22
DNAT       tcp  --  anywhere             anywhere            tcp dpt:hpssd to:192.168.0.7:22
DNAT       tcp  --  anywhere             anywhere            tcp dpt:hpiod to:192.168.0.8:22
DNAT       tcp  --  anywhere             anywhere            tcp dpt:rimf-ps to:192.168.0.9:22
DNAT       tcp  --  anywhere             anywhere            tcp dpt:http to:192.168.0.6:80
DNAT       tcp  --  anywhere             anywhere            tcp dpt:ica to:192.168.0.6:1494
DNAT       tcp  --  anywhere             anywhere            tcp dpt:shell to:192.168.0.2:514
DNAT       tcp  --  anywhere             anywhere            tcp dpt:avt-profile-2 to:192.168.0.5:5005
DNAT       tcp  --  anywhere             anywhere            tcp dpt:wsm-server to:192.168.0.5:5006
DNAT       tcp  --  anywhere             anywhere            tcp dpt:wsm-server-ssl to:192.168.0.5:5007
DNAT       tcp  --  anywhere             anywhere            tcp dpt:synapsis-edge to:192.168.0.5:5008
DNAT       tcp  --  anywhere             anywhere            tcp dpt:winfs to:192.168.0.5:5009
DNAT       tcp  --  anywhere             anywhere            tcp dpt:telelpathstart to:192.168.0.5:5010
DNAT       tcp  --  anywhere             anywhere            tcp dpt:50000 to:192.168.0.5:50000
DNAT       tcp  --  anywhere             anywhere            tcp dpt:50005 to:192.168.0.5:50005
DNAT       tcp  --  anywhere             anywhere            tcp dpt:50009 to:192.168.0.5:50009
DNAT       tcp  --  anywhere             anywhere            tcp dpt:50010 to:192.168.0.5:50010
DNAT       tcp  --  anywhere             anywhere            tcp dpt:50011 to:192.168.0.5:50011
DNAT       tcp  --  anywhere             anywhere            tcp dpt:50012 to:192.168.0.5:50012
DNAT       tcp  --  anywhere             anywhere            tcp dpt:50013 to:192.168.0.5:50013
DNAT       tcp  --  anywhere             anywhere            tcp dpt:50014 to:192.168.0.5:50014
DNAT       tcp  --  anywhere             anywhere            tcp dpt:50184 to:192.168.0.5:50184
DNAT       tcp  --  anywhere             anywhere            tcp dpt:50185 to:192.168.0.5:50185
DNAT       tcp  --  anywhere             anywhere            tcp dpt:50186 to:192.168.0.5:50186
DNAT       tcp  --  anywhere             anywhere            tcp dpt:50187 to:192.168.0.5:50187
DNAT       tcp  --  anywhere             anywhere            tcp dpt:50188 to:192.168.0.5:50188
DNAT       tcp  --  anywhere             anywhere            tcp dpt:50189 to:192.168.0.5:50189
DNAT       tcp  --  anywhere             anywhere            tcp dpt:50000 to:192.168.0.5:50000
DNAT       tcp  --  anywhere             anywhere            tcp dpt:50005 to:192.168.0.5:50005
DNAT       tcp  --  anywhere             anywhere            tcp dpt:50009 to:192.168.0.5:50009
DNAT       tcp  --  anywhere             anywhere            tcp dpts:50010:50014 to:192.168.0.5:50010-50014
DNAT       tcp  --  anywhere             anywhere            tcp dpts:50184:50189 to:192.168.0.5:50184-50189
DNAT       tcp  --  anywhere             anywhere            tcp dpt:binderysupport to:192.168.0.2:23
DNAT       tcp  --  anywhere             anywhere            tcp dpt:proxy-gateway to:192.168.0.3:23
DNAT       tcp  --  anywhere             anywhere            tcp dpt:attachmate-uts to:192.168.0.4:23
DNAT       tcp  --  anywhere             anywhere            tcp dpt:mt-scaleserver to:192.168.0.5:23
DNAT       tcp  --  anywhere             anywhere            tcp dpt:tappi-boxnet to:192.168.0.6:23
DNAT       tcp  --  anywhere             anywhere            tcp dpts:checkoutdb:5510 to:192.168.0.5:5505-5510
DNAT       tcp  --  anywhere             anywhere            tcp dpt:gotodevice to:192.168.0.17:22
DNAT       tcp  --  anywhere             anywhere            tcp dpt:foliocorp to:192.168.0.42:22
DNAT       tcp  --  anywhere             anywhere            tcp dpt:magicom to:192.168.0.43:22
DNAT       tcp  --  anywhere             anywhere            tcp dpt:nmsserver to:192.168.0.44:22
DNAT       tcp  --  anywhere             anywhere            tcp dpt:hao to:192.168.0.45:22
DNAT       tcp  --  anywhere             anywhere            tcp dpt:pc-mta-addrmap to:192.168.0.46:22
DNAT       tcp  --  anywhere             anywhere            tcp dpt:antidotemgrsvr to:192.168.0.47:22
DNAT       tcp  --  anywhere             anywhere            tcp dpt:remote-collab to:192.168.0.50:22
DNAT       tcp  --  anywhere             anywhere            tcp dpt:dif-port to:192.168.0.51:22
DNAT       tcp  --  anywhere             anywhere            tcp dpt:lnvalarm to:192.168.0.82:22
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-11-19 11:15:50

使用iptables -F PREROUNTING,您可以删除所有链式预排序的规则。

使用iptables -D PREROUTING 1,您可以从链式PREROUTING中删除单个第一条规则。因此,要删除上述两条规则,您必须使用相同的命令两次。

使用iptables -t nat -D PREROUTING -p tcp --dport 12348 -j DNAT -目的地192.168.0.5:12348iptables -t nat -D PREROUTING -p tcp -dport 7778 -j DNAT - to -dport 192.168.0.5:7778删除这两条具体规则。

只是将-I替换为-D。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20069817

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档