y允许192.168.2.0网段的客户机NAT转换
iptables -t nat -A POSTROUTING -s 192.168.2.0/24 -o eth0 -j SNAT --to 192.168.101.100
iptables -t nat -A POSTROUTING -s 192.168.2.0/24 -o eth0 -j MASQUERADE
设置192.168.101.100D NAT为192.168.2.100
iptables -t nat -A PREROUTING -d 192.168.101.100 -i eth0 -j DNAT --to 192.168.2.100
开启127.0.0.1
iptables -t filter -A INPUT -i lo -j ACCEPT
iptables -t filter -A OUTPUT -o lo -j ACCEPT
开启ping 通过
iptables -t filter -A INPUT -s 192.168.101.100 -p icmp --icmp-type echo-request(8) -j ACCEPT
iptables -t filter -A OUTPUT -d 192.168.101.100 -p icmp --icmp-type echo-type echo-replay(0) -j ACCEPT
允许DNS的NAT转换和通过
iptables -t nat -A POSTROUTING -m iprange --src-range 192.168.2.21-192.168.2.40 -m time --weekdays Mon,Tue,Wed,Thu,Fri --timestart 08:00 --timestop 20:00 -p udp --dport 53 -o eth0 -j MASQUERADE
iptables -t filter -I FORWARD 2 -m iprange --src-range 192.168.2.21-192.168.2.40 -p udp --dport 53 -j ACCEPT 本文出自 “紫衣封侯” 博客,请务必保留此出处http://zyfhlegend.blog.51cto.com/3414253/685299
|