|
我想通过iptables 带动局域网内另一台机子共享上网,可是它能上校园网,却怎么也上不了因特网,请高手帮忙解决.我的规则如下:
#!/bin/sh
IPT=/sbin/iptables
LAN_FACE=192.168.13.5
INET_FACE=0/0
echo "1" >/proc/sys/net/ipv4/ip_forward
echo "1" >/proc/sys/net/ipv4/ip_dynaddr
/sbin/modprobe ip_nat_ftp
$IPT -F
$IPT -t nat -F
$IPT -X
$IPT -P INPUT DROP
$IPT -P OUTPUT DROP
$IPT -P FORWARD DROP
$IPT -A INPUT -i lo -j ACCEPT
$IPT -A OUTPUT -o lo -j ACCEPT
$IPT -A INPUT -s $LAN_FACE -i eth0 -p tcp --dport 23 -j ACCEPT
$IPT -A INPUT -p tcp ! --syn -j ACCEPT
$IPT -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
$IPT -A OUTPUT -j ACCEPT
$IPT -t nat -A POSTROUTING -s $LAN_FACE -o ppp+ -j MASQUERADE
$IPT -t nat -A PREROUTING -s $INET_FACE -i ppp+ -j DNAT --to $LAN_FACE
$IPT -A FORWARD -s $LAN_FACE -i eth0 -o ppp+ -d $INET_FACE -j ACCEPT
$IPT -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
$IPT -A FORWARD -s $INET_FACE -i ppp+ -p udp --sport 53 -o eth0 -d $LAN_FACE -j ACCEPT |
|