我有以下的iptable规则,并需要帮助删除它,如果可能的话?
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:
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
使用iptables -F PREROUNTING可以删除链式PREROUNTING的所有规则。
使用iptables -D PREROUTING 1你可以从链PREROUTING中删除一个单独的第一条规则。 所以要删除以上两条规则,你必须使用相同的命令两次。
使用iptables -t nat -D PREROUTING -p tcp -dport 12348 -j DNAT -to-destination 192.168.0.5:12348和iptables -t nat -D PREROUTING -p tcp –dport 7778 -j DNAT –to-目的地192.168.0.5:7778删除这两个特定的规则。
用-D替换-I。