[zz]NAT分享ip上网

echo "1" > /proc/sys/net/ipv4/ip_forward
echo "1" > /proc/sys/net/ipv4/tcp_syncookies
modprobe ip_tables
modprobe ip_nat_ftp
modprobe ip_nat_irc
modprobe ip_conntrack
modprobe ip_conntrack_ftp
modprobe ip_conntrack_irc
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
#iptables -t nat -A POSTROUTING -s 192.168.2.0/255.255.255.0 -j SNAT --to 152.104.180.172
iptables -A FORWARD -s 192.168.2.182 -j ACCEPT
iptables -A FORWARD -d 192.168.2.182 -j ACCEPT
iptables -t nat -P PREROUTING ACCEPT
iptables -t nat -P POSTROUTING ACCEPT
iptables -t nat -P OUTPUT ACCEPT
iptables -t nat -A PREROUTING -i eth1 -p tcp -d 152.104.180.171 -j DNAT --to-destination 192.168.2.182
iptables -t nat -A PREROUTING -i eth0 -p tcp -d 152.104.180.171 -j DNAT --to-destination 192.168.2.182
iptables -t nat -A POSTROUTING -s 192.168.2.0/255.255.255.0 -j SNAT --to 152.104.180.171

posted on 2012-05-15 15:19  yxyx213  阅读(237)  评论(0编辑  收藏  举报

导航