环境:
机器外网IP: 192.168.2.100
机器内网IP: 192.168.1.100
内网WEB服务器: 192.168.1.10
目的:实现外网能够访问内网WEB服务器
方法:通过iptables做NAT,端口映射
iptables命令:
iptables -t nat -A PREROUTING -p tcp -d 192.168.2.100 –dport 1001 -j DNAT –to-destination 192.168.1.10:80
iptables -t nat -A POSTROUTING -p tcp -j SNAT –to 192.168.2.100
有时间,我们可以去爬山,