|
|
发表于 2004-6-6 23:01:07
|
显示全部楼层
不用squid也能实现!
用iptables
-------------------------------------------------------------------
echo 1 > /proc/sys/net/ipv4/ip_forward
/sbin/modprobe ip_nat_ftp
/sbin/modprobe ip_nat_irc
/sbin/modprobe ip_nat_tftp
/sbin/modprobe iptable_mangle
/sbin/modprobe ip_conntrack_tftp
echo Begin the NAT Gating
#flush current config
/sbin/iptables -F INPUT
/sbin/iptables -F FORWARD
/sbin/iptables -F POSTROUTING -t nat
#open the NAT and forward
/sbin/iptables -t nat -F
/sbin/iptables -P FORWARD DROP
/sbin/iptables -A FORWARD -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT
#config the users
/sbin/iptables -A FORWARD -s 10.22.21.55/32 -j ACCEPT
/sbin/iptables -t nat -A POSTROUTING -o eth0 -s 10.22.21.55/32 -j SNAT --to 10.22.21.54
----------------------------------------------------------------------
将以上内容写进文件然后以root运行!
其中10.22.21.54改为你的ip地址,10.22.21.55改为你的用户地址,对于多个用户,请按照最后两行的样子添加就行了!
客户端只要将网关改成你就ok了! |
|