|
iptables -F
iptables -X
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP
iptables -A INPUT -p icmp -j ACCEPT
iptables -A OUTPUT -p icmp -j ACCEPT
iptables -A INPUT -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A INPUT -t udp --dport 53 -j ACCEPT
iptables -A OUTPUT -t udp --dport 53 -j ACCEPT
(设置到这儿,我是可以在linux机器上ping通外部的机器的.如ping 210.22.70.3 ping www.online.sh.cn)
接下来我设置nat
iptables -t nat -F
iptables -t nat -X
iptalbles -t nat -P POSTROUTING ACCEPT
iptables -t nat -P PREROUTING ACCEPT
iptables -t nat -P OUTPUT ACCEPT
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j SNAT --to-source *.*.*.*
iptables -A FORWARD -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A FORWARD -p udp --dport 53 -j ACCEPT
iptables -A FORWARD -p tcp --dprot 80 -j ACCEPT
iptables -A FORWARD -p icmp -j ACCEPT
(写好这些以后发现问题:192.168.0.0网段的计算机可以ping linux的内网卡192.168.0.1和外网卡*.*.*.*,但是无法ping通外网,linux计算机还是正常的!
请各位大大指点迷津!!! |
|