|
|
1.同志们,我想让局域网内都可以访问google,但是使用了这个规则后依然无法访问,但是把google的网址换成ip后就可以了,请问是为什么呢?
iptables -A FORWARD -i eth0 -o eth1 -p tcp -d google.com --dport 80 -j ACCEPT
2.端口映射问题
A机有两个ip192.168.92.81 和192.168.0.81,我把对192.168.92.81的80端口映射到192.168.0.82上,但是在192.168.92.0/24网段中测试无法访问到http服务器,不知道是为什么?
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 443 -j DNAT --to 192.168.0.82:80
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
DNAT tcp -- anywhere anywhere tcp dpt:http to:192.168.0.82:80
DNAT tcp -- anywhere anywhere tcp dpt:https to:192.168.0.82:443
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
SNAT all -- 192.168.0.82 anywhere to:192.168.92.81
Chain OUTPUT (policy ACCEPT)
target prot opt source destination |
|