增加命令
[root@pre /]# iptables -t nat -A PREROUTING -s 39.15.15.15/32 -d 221.11.8.200/32 -p tcp -m tcp --dport 9999 -j DNAT --to-destination 192.168.1.215:80
[root@pre /]# iptables -t nat -A OUTPUT -p tcp -m tcp --dport 9999 -j DNAT --to-destination 192.168.1.215:80
[root@pre /]# iptables -t nat -L -n
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
DNAT tcp -- 39.15.15.15 221.11.8.200 tcp dpt:9999 to:192.168.1.215:80
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination Chain OUTPUT (policy ACCEPT)
target prot opt source destination
DNAT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:9999 to:192.168.1.215:80
删除命令
[root@pre /]# iptables -t nat -D PREROUTING -s 39.15.15.15/32 -d 221.11.8.200/32 -p tcp -m tcp --dport 9999 -j DNAT --to-destination 192.168.1.215:80
[root@pre /]# iptables -t nat -D OUTPUT -p tcp -m tcp --dport 9999 -j DNAT --to-destination 192.168.1.215:80
[root@pre /]# iptables -t nat -L -n
Chain PREROUTING (policy ACCEPT)
target prot opt source destination Chain POSTROUTING (policy ACCEPT)
target prot opt source destination Chain OUTPUT (policy ACCEPT)
target prot opt source destination