网吧使用的Nat+Iptables+Squid的脚本
2007-04-21 12:41:39 来源:WEB开发网#装载模块modules
###--------------------------------------------------------------------###
echo "模块正在载人......"
modprobe ip_tables &>/dev/null || {
echo -n "$(basename $0): ip_tables模块载人失败"
echo "请检查"
exit 3
}
for file in /lib/modules/`uname -r`/kernel/net/ipv4/netfilter/ip_conntrack_*.o
do
module=$(basename $file)
modprobe ${module%.*} &>/dev/null
done
for file in /lib/modules/`uname -r`/kernel/net/ipv4/netfilter/ip_nat_*.o
do
module=$(basename $file)
modprobe ${module%.*} &>/dev/null
done
# ------------- 端口开启 ------------
echo "开启所要的端口...."
iptables -N services
for PORT in $TRUSTED_TCP_PORT; do
iptables -A services -i $EXT_IF -p tcp --dport $PORT -j ACCEPT
done
for PORT in $TRUSTED_UDP_PORT; do
iptables -A services -i $EXT_IF -p udp --dport $PORT -j ACCEPT
done
#----ipforwarding--------
echo "打开foward功能"
echo "1" > /proc/sys/net/ipv4/ip_forward
#动态ip使用
#
#echo "1" > /proc/sys/net/ipv4/ip_dynaddr
#这里是动态ip实现nat共享必改之处
###---------------------------------------------------###
#清除先前的设定
###---------------------------------------------------###
更多精彩
赞助商链接