iptables端口映射问题
red hat linux 9 中,外网地址为1.2.3.4,内网地址为192.168.1.1,eth0作外网,eth1为内网.web服务器地址为192.168.1.200.
默认策略为拒绝.
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP
做了端口映射后,内网ip可以访问web服务,但公网ip不能访问web服务.
iptables -t -nat -A PREROUTING -i eth1 -p tcp -d 1.2.3.4 --dport 80 -j DNAT --to-destination 192.168.1.200:80
iptables -t -nat -A PREROUTING -i eth0 -p tcp -d 1.2.3.4 --dport 80 -j DNAT --to-destination 192.168.1.200:80
iptables -t -nat -A POSTROUTING -s 192.168.1.0/255.255.255.0 -j SNAT --to 1.2.3.4
不知道哪一步出错了.