- 论坛徽章:
- 0
|
os: redhat AS 3 kernel:2.4.21
gw1: 192.168.0.2
gw2:192.168.0.207 redhat 8.0 kernel: 2.4
gw2是4M光纤上网,只是做了如下配置:
- iptables -t nat -A POSTROUTING -s 0/0 -j MASQUERADE
复制代码
gw1上是2M光线上网,做了tc,ipp2p,time等相关设置
dnat部分
- iptables -t nat -A PREROUTING -d 218.249.xx.xx -p tcp -m time --timestart 9:00 --timestop 23:59 --days Mon,Tue,Wed,Thu,Fri --dpor
- t 19022 -j DNAT --to 192.168.0.207:22
- iptables -t nat -A POSTROUTING -d 192.168.0.207 -p tcp --dport 22 -j SNAT --to 192.168.0.2:19022
复制代码
DNAT说明:
由于服务器对IP做了访问限制。从外面访问的用户需要登陆gw1来访问内网,通过dnat把19022转发到内网的gw2上。然后在gw2上做回指gw2的路由
- [root@mnc-y root]# route -n
- Kernel IP routing table
- Destination Gateway Genmask Flags Metric Ref Use Iface
- 192.168.0.2 192.168.0.2 255.255.255.255 UGH 0 0 0 eth0
复制代码
这样就形成了外网用户通过DNAT来访问gw1,然后转发到gw2上。gw2在通过自己的默认网关访问公司在IDC的服务器。
问题出来了:
1.当第一次连接的时候非常的快。但一旦断了连接在重新连接。就会提示连接超时!-----------------------------------------------------------------------------------------------------------------
问题分析:
1。通过在gw1上抓包来看
- [root@gateway shell]# tcpdump -i eth1 -vv -nn port 19022
- tcpdump: listening on eth1
- 09:05:26.297887 210.82.61.xx.3566 > 218.249.xx.xx.19022: S [tcp sum ok] 3706006814:3706006814(0) win 16384 <mss 1460,nop,nop,sackOK> (DF) (ttl 114, id 28066, len 48)
- 09:05:29.212386 210.82.61.xx.3566 > 218.249.xx.xx.19022: S [tcp sum ok] 3706006814:3706006814(0) win 16384 <mss 1460,nop,nop,sackOK> (DF) (ttl 114, id 28073, len 48)
- 09:05:35.247140 210.82.61.xx.3566 > 218.249.xx.xx.19022: S [tcp sum ok] 3706006814:3706006814(0) win 16384 <mss 1460,nop,nop,sackOK> (DF) (ttl 114, id 28080, len 48)
复制代码
发现只有SYN的请求数据包,没有ack的返回包。
2。ping 218.249.xx.xx
- C:\Documents and Settings\WangSP>ping 218.249.xx.xx
- Pinging 218.249.109.132 with 32 bytes of data:
- Reply from 218.249.xx1xx: bytes=32 time=1317ms TTL=48
- Reply from 218.249.1xx.xx: bytes=32 time=1056ms TTL=48
- Reply from 218.249.xx.xx: bytes=32 time=1167ms TTL=48
- Reply from 218.249.xx.xx: bytes=32 time=1004ms TTL=48
- Ping statistics for 218.249.xx.xx:
- Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
- Approximate round trip times in milli-seconds:
- Minimum = 1004ms, Maximum = 1317ms, Average = 1136ms
复制代码
虽然延时有点大,但也不会出现这样的问题
3.在gw1上发现一条策略
- iptables -A INPUT -i eth1 -p tcp --syn -m connlimit --connlimit-above 25 -j DROP
复制代码
对外网的初始华连接限制在25以内。注销掉看看,可是问题依旧。
请各位老师讨论一下吧。指点迷津! |
|