iptables 代理转发配置

增加命令

[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

  

上一篇:Java开发者必备的10大学习网站,送给入门学习java的你,请收下!


下一篇:20个开发人员非常有用的Java功能代码