iptable端口映射

1、/etc/sysctl.conf中
net.ipv4.ip_forward=1
2、sysctl -p 生效
3、iptables -t nat --list
iptables -t nat --list --line
iptables -t nat -L POSTROUTING --line
iptables -t nat -D POSTROUTING 9
iptables -t nat -D PREROUTING 2
iptables --list --line
iptables -D INPUT 5
4、不通
iptables -t nat -I PREROUTING -d 192.168.3.10 -p tcp --dport 10000 -j DNAT --to-destination 192.168.122.16:22
iptables -t nat -I PREROUTING -d 192.168.3.10 -p tcp --dport 8000 -j DNAT --to-destination 192.168.122.16:80
5、iptables -t nat --list -v
iptables -t nat -I POSTROUTING -s 192.168.122.0/24 -j SNAT --to-source 192.168.3.10
6、检查手段
http://www.zsythink.net/wp-content/uploads/2017/02/021217_0051_6.png
iptables -nvL INPUT
iptables -I INPUT -j LOG --log-prefix "IP_LOG:"
dmesg | grep "IP_LOG:"
iptables-save
终于通了......

http://www.zsythink.net/archives/1764
https://www.jianshu.com/p/d4efe88c20d2

标签: none

添加新评论