| 
 | 
 
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册 
 
 
 
×
 
Linux+squid+nat透明代理路 
 
内网的服务器映射出去.可是在外网以及内网用HLSW连接后的结果,是一断一断的。连接的时候也是隔上5秒-10秒 就连接不上去了.外网连接进来全部显示代理服务器的IP,管理极不方便. 
我用的是iptables  
网关:192.168.0.1/255.255.255.0  
外网:eth0,内网:eth1 
CS服务器是192.168.0.254 ,iptables的语法是这样的 
********* 
#!/bin/sh 
/sbin/modprobe ip_tables 
/sbin/modprobe ip_nat_ftp 
/sbin/modprobe ip_conntrack_ftp 
/sbin/iptables -F 
/sbin/iptables -F -t nat 
/sbin/iptables -X 
/sbin/iptables -Z 
 
echo"1">/proc/sys/net/ipv4/ip_forward 
/sbin/iptables -P INPUT ACCEPT 
/sbin/iptables -P FORWARD ACCEPT 
/sbin/iptables -P OUTPUT ACCEPT 
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j SNAT --to xxx.xxx.xxx.xxx 
iptables -A FORWARD -s 0/0 -d 0/0 -j ACCEPT 
iptables -A PREROUTING -s 192.168.0.0/24 -i eth1 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 3128 
iptables -A PREROUTING -s 192.168.0.0/24 -i eth1 -p tcp -m tcp --dport 443 -j REDIRECT --to-ports 3128 
 
iptables -A INPUT -p icmp --icmp-type 8 -s 0/0 -j DROP 
iptables -A INPUT -p icmp --icmp-type 0 -s 0/0 -j ACCEPT 
 
/sbin/iptables -t nat -A PREROUTING -d xxx.xxx.xxx.xxx -p udp --dport 27015 -j DNAT --to 192.168.0.254 
/sbin/iptables -t nat -A POSTROUTING -d 192.168.0.254 -p udp --dport 27015 -o eth1 -j SNAT --to 192.168.0.1 
/sbin/iptables -t nat -A POSTROUTING -s 192.168.0.254 -p udp --dport 27010:27012 -o eth1 -j SNAT --to 192.168.0.1 
/sbin/iptables -t nat -A POSTROUTING -s 192.168.0.254 -p tcp --dport 5273 -o eth1 -j SNAT --to 192.168.0.1 
/sbin/iptables -t nat -A POSTROUTING -s 192.168.0.254 -p tcp --dport 7002 -o eth1 -j SNAT --to 192.168.0.1 
/sbin/iptables -t nat -A POSTROUTING -s 192.168.0.254 -p udp --dport 27010:27012 -o eth0 -j SNAT --to 202.103.xxx.xxx 
/sbin/iptables -t nat -A POSTROUTING -s 192.168.0.254 -p tcp --dport 5273 -o eth0 -j SNAT --to XXX.XXX.xxx.xxx 
/sbin/iptables -t nat -A POSTROUTING -s 192.168.0.254 -p tcp --dport 7002 -o eth0 -j SNAT --to xxx.xxx.xxx.xxx 
 
 
********** 
大家给我看看出什么问题了~~~ 
很有周期性的 
外网进去玩不会出现断线的现象,完全是正常玩的。 |   
- 
 
 
 
 
 
 
 
 |