亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

Chinaunix

標(biāo)題: Iptables NAT tcp連接中斷 [打印本頁]

作者: DreamAndLove    時(shí)間: 2012-11-07 16:51
標(biāo)題: Iptables NAT tcp連接中斷
本帖最后由 DreamAndLove 于 2012-11-07 20:41 編輯

系統(tǒng)描述(linux):
PC1 -> nat服務(wù)器, kernel: 2.6.37
     eth0:  10.27.16.65
     usb0:  192.168.0.254

iptable rules:
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -s 255.255.255.252/30 -j ACCEPT
iptables -t nat -A PREROUTING -d 10.27.16.65 -j DNAT --to 192.168.0.253
iptables -t nat -A POSTROUTING -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
iptables -t nat -A POSTROUTING -s 192.168.0.253 -j SNAT --to 10.27.16.65

route table:
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.252   0.0.0.0         255.255.255.252 U     0      0        0 usb0
10.27.16.0      0.0.0.0         255.255.248.0   U     0      0        0 eth0
0.0.0.0         10.27.16.1      0.0.0.0         UG    0      0        0 eth0



PC2 -> 客戶端 route add default gw 192.168.0.254
     usb0:  192.168.0.253

route table:
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.0.254   0.0.0.0         UG    0      0        0 usb0
192.168.0.252   *               255.255.255.252 U     0      0        0 usb0


問題描述:PC2上tcp連接隨機(jī)中斷
PC2 -> wget http://10.27.16.157/a.apk
    走同網(wǎng)段的地址,tcp連接正常,不會(huì)出任何錯(cuò)誤

   -> wget http://10.27.122.64/a.apk
    走其他網(wǎng)段地址, tcp連接出現(xiàn)隨機(jī)中斷
    error_1 string:  - stalled -
    error_2 string:  wget: read error: Connection reset by peer

   -> 出現(xiàn)錯(cuò)誤時(shí), 在10.27.122.64服務(wù)器端抓包,會(huì)有一系列的TCP RST狀態(tài)的包; 但是在PC2上的抓包,卻沒有發(fā)現(xiàn)PC2發(fā)出這些RST狀態(tài)的包.

作者: chenyx    時(shí)間: 2012-11-07 16:51
規(guī)則沒有問題啊,太奇怪了. 請@platinum版主幫忙吧
作者: chenyx    時(shí)間: 2012-11-07 19:42
iptables -A FORWARD -s 255.255.255.252/30 -j ACCEPT
iptables -t nat -A PREROUTING -d 10.27.16.65 -j DNAT --to 192.168.0.253
iptables -t nat -A POSTROUTING -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu

這幾行注釋下看看
作者: DreamAndLove    時(shí)間: 2012-11-07 19:58
本帖最后由 DreamAndLove 于 2012-11-07 20:01 編輯

回復(fù) 2# chenyx
  1. iptables -A FORWARD -s 255.255.255.252/30 -j ACCEPT
  2. iptables -t nat -A PREROUTING -d 10.27.16.65 -j DNAT --to 192.168.0.253
  3. iptables -t nat -A POSTROUTING -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
復(fù)制代碼
注釋了這三行,還是會(huì)出現(xiàn)這個(gè)錯(cuò)誤!


   
作者: chenyx    時(shí)間: 2012-11-07 20:07
你將PC1上iptables的規(guī)則和路由表都貼一下吧.
另外,你在PC1上wget122網(wǎng)段的,會(huì)不會(huì)出現(xiàn)中斷的現(xiàn)象?
作者: DreamAndLove    時(shí)間: 2012-11-07 20:19
單獨(dú)在PC1上wget http://10.27.122.64/a.apk, 沒有任何錯(cuò)誤,
只有在PC2上執(zhí)行wget時(shí),才會(huì)出現(xiàn)tcp連接中斷的問題
作者: chenyx    時(shí)間: 2012-11-07 20:25
挺奇怪的,你把iptables -t nat -L -nv的結(jié)果貼一下.
作者: DreamAndLove    時(shí)間: 2012-11-07 20:28
本帖最后由 DreamAndLove 于 2012-11-07 20:32 編輯

回復(fù) 6# chenyx
iptable rules
  1. # iptables -nvL
  2. Chain INPUT (policy ACCEPT 2915 packets, 335K bytes)
  3. pkts bytes target     prot opt in     out     source               destination         

  4. Chain FORWARD (policy ACCEPT 3 packets, 180 bytes)
  5. pkts bytes target     prot opt in     out     source               destination         
  6. 2554 2690K ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0            state RELATED,ESTABLISHED

  7. Chain OUTPUT (policy ACCEPT 1252 packets, 176K bytes)
  8. pkts bytes target     prot opt in     out     source               destination

  9. # iptables -t nat -nvL
  10. Chain PREROUTING (policy ACCEPT 170 packets, 24890 bytes)
  11. pkts bytes target     prot opt in     out     source               destination         

  12. Chain INPUT (policy ACCEPT 168 packets, 24770 bytes)
  13. pkts bytes target     prot opt in     out     source               destination         

  14. Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
  15. pkts bytes target     prot opt in     out     source               destination         

  16. Chain POSTROUTING (policy ACCEPT 0 packets, 0 bytes)
  17. pkts bytes target     prot opt in     out     source               destination         
  18.     2   120 SNAT       all  --  *      *       192.168.0.253       0.0.0.0/0            to:10.27.16.65
復(fù)制代碼

作者: DreamAndLove    時(shí)間: 2012-11-07 20:37
回復(fù) 8# chenyx
謝謝!
platinum版主在線嗎?

   
作者: DreamAndLove    時(shí)間: 2012-11-08 10:41
@platinum版主, 幫忙看看大概什么原因產(chǎn)生這種bug
作者: DreamAndLove    時(shí)間: 2012-11-08 18:07
問題已經(jīng)解決,謝謝@chenyx!
作者: chenyx    時(shí)間: 2012-11-08 18:37
回復(fù) 11# DreamAndLove


    什么原因造成的這個(gè)問題?查到原因了嗎
作者: DreamAndLove    時(shí)間: 2012-11-10 15:28
回復(fù) 12# chenyx
找到原因了,因?yàn)镻C1是工程開發(fā)機(jī)器,所有的網(wǎng)卡信息一致,數(shù)據(jù)到達(dá)到網(wǎng)關(guān)層,互相沖突。


   




歡迎光臨 Chinaunix (http://www.72891.cn/) Powered by Discuz! X3.2