Linux 랩톱에서 TCP가 종료 됨 1360,sackOK,TS val 33770316

며칠에 한 번 다음과 같은 문제가 있습니다. 랩톱 (데비안 테스트)이 갑자기 인터넷에 대한 TCP 연결로 작동하지 않습니다.

다음은 계속 잘 작동합니다.

  • UDP (DNS), ICMP (ping) — 즉각적인 응답을받습니다
  • 로컬 네트워크의 다른 컴퓨터에 대한 TCP 연결 (예 : 인접 랩톱에 ssh 가능)
  • 내 LAN의 다른 컴퓨터에는 모든 것이 정상입니다.

그러나 랩톱에서 TCP 연결을 시도하면 시간이 초과됩니다 (SYN 패킷에 대한 응답 없음). 다음은 일반적인 curl 출력입니다.

% curl -v google.com
* About to connect() to google.com port 80 (#0)
*   Trying 173.194.39.105...
* Connection timed out
*   Trying 173.194.39.110...
* Connection timed out
*   Trying 173.194.39.97...
* Connection timed out
*   Trying 173.194.39.102...
* Timeout
*   Trying 173.194.39.98...
* Timeout
*   Trying 173.194.39.96...
* Timeout
*   Trying 173.194.39.103...
* Timeout
*   Trying 173.194.39.99...
* Timeout
*   Trying 173.194.39.101...
* Timeout
*   Trying 173.194.39.104...
* Timeout
*   Trying 173.194.39.100...
* Timeout
*   Trying 2a00:1450:400d:803::1009...
* Failed to connect to 2a00:1450:400d:803::1009: Network is unreachable
* Success
* couldn't connect to host
* Closing connection #0
curl: (7) Failed to connect to 2a00:1450:400d:803::1009: Network is unreachable

연결을 다시 시작하거나 네트워크 카드 커널 모듈을 다시로드해도 도움이되지 않습니다. 도움이되는 유일한 것은 재부팅입니다.

분명히 내 시스템에 문제가 있습니다 (다른 모든 것이 잘 작동 함).하지만 정확히 무엇인지 모릅니다.

내 설정은 PPPoE를 통해 ISP에 연결된 무선 라우터입니다.

어떤 충고?

의견에 대한 답변

어떤 NIC입니까?

12:00.0 Network controller: Broadcom Corporation BCM4313 802.11b/g/n Wireless LAN Controller (rev 01)
  Subsystem: Dell Inspiron M5010 / XPS 8300
  Flags: bus master, fast devsel, latency 0, IRQ 17
  Memory at fbb00000 (64-bit, non-prefetchable) [size=16K]
  Capabilities: [40] Power Management version 3
  Capabilities: [58] Vendor Specific Information: Len=78 <?>
  Capabilities: [48] MSI: Enable- Count=1/1 Maskable- 64bit+
  Capabilities: [d0] Express Endpoint, MSI 00
  Capabilities: [100] Advanced Error Reporting
  Capabilities: [13c] Virtual Channel
  Capabilities: [160] Device Serial Number 00-00-9d-ff-ff-aa-1c-65
  Capabilities: [16c] Power Budgeting <?>
  Kernel driver in use: brcmsmac

문제가 발생했을 때 NIC의 상태는 어떻습니까?

iptables-save 아무것도 인쇄하지 않습니다.

ip rule show:

0:  from all lookup local
32766:  from all lookup main
32767:  from all lookup default

ip route show table all:

default via 192.168.1.1 dev wlan0
192.168.1.0/24 dev wlan0  proto kernel  scope link  src 192.168.1.105
broadcast 127.0.0.0 dev lo  table local  proto kernel  scope link  src 127.0.0.1
local 127.0.0.0/8 dev lo  table local  proto kernel  scope host  src 127.0.0.1
local 127.0.0.1 dev lo  table local  proto kernel  scope host  src 127.0.0.1
broadcast 127.255.255.255 dev lo  table local  proto kernel  scope link  src 127.0.0.1
broadcast 192.168.1.0 dev wlan0  table local  proto kernel  scope link  src 192.168.1.105
local 192.168.1.105 dev wlan0  table local  proto kernel  scope host  src 192.168.1.105
broadcast 192.168.1.255 dev wlan0  table local  proto kernel  scope link  src 192.168.1.105
fe80::/64 dev wlan0  proto kernel  metric 256
unreachable default dev lo  table unspec  proto kernel  metric 4294967295  error -101 hoplimit 255
local ::1 via :: dev lo  table local  proto none  metric 0
local fe80::1e65:9dff:feaa:b1f1 via :: dev lo  table local  proto none  metric 0
ff00::/8 dev wlan0  table local  metric 256
unreachable default dev lo  table unspec  proto kernel  metric 4294967295  error -101 hoplimit 255

기기가 정상 모드에서 작동하는 경우 위의 모든 사항이 동일합니다.

ifconfig— 실행했지만 재부팅 전에 저장하는 것을 잊었습니다. 다음에 문제가 발생할 때까지 기다려야합니다. 미안합니다.

QoS가 있습니까?

아마도 아닙니다. 적어도 그것을 가능하게하기 위해 특별히 아무것도 한 적이 없습니다.

실제로 인터페이스로 전송 된 트래픽을 스니핑하려고 했습니까?

curl과 tcpdump를 여러 번 실행했으며 두 가지 패턴이있었습니다.

첫 번째는 응답없는 SYN 패킷입니다.

17:14:37.836917 IP (tos 0x0, ttl 64, id 4563, offset 0, flags [DF], proto TCP (6), length 60)
    192.168.1.105.42030 > fra07s07-in-f102.1e100.net.http: Flags [S], cksum 0x27fc (incorrect -> 0xbea8), seq 3764607647, win 13600, options [mss 1360,sackOK,TS val 33770316 ecr 0,nop,wscale 4], length 0
17:14:38.836650 IP (tos 0x0, ttl 64, id 4564, offset 0, flags [DF], proto TCP (6), length 60)
    192.168.1.105.42030 > fra07s07-in-f102.1e100.net.http: Flags [S], cksum 0x27fc (incorrect -> 0xbdae), seq 3764607647, win 13600, options [mss 1360,sackOK,TS val 33770566 ecr 0,nop,wscale 4], length 0
17:14:40.840649 IP (tos 0x0, ttl 64, id 4565, offset 0, flags [DF], proto TCP (6), length 60)
    192.168.1.105.42030 > fra07s07-in-f102.1e100.net.http: Flags [S], cksum 0x27fc (incorrect -> 0xbbb9), seq 3764607647, win 13600, options [mss 1360,sackOK,TS val 33771067 ecr 0,nop,wscale 4], length 0

두 번째는 이것입니다 :

17:22:56.507827 IP (tos 0x0, ttl 64, id 41583, offset 0, flags [DF], proto TCP (6), length 60)
    192.168.1.105.42036 > fra07s07-in-f102.1e100.net.http: Flags [S], cksum 0x27fc (incorrect -> 0x2244), seq 1564709704, win 13600, options [mss 1360,sackOK,TS val 33894944 ecr 0,nop,wscale 4], length 0
17:22:56.546763 IP (tos 0x58, ttl 54, id 65442, offset 0, flags [none], proto TCP (6), length 60)
    fra07s07-in-f102.1e100.net.http > 192.168.1.105.42036: Flags [S.], cksum 0x6b1e (correct), seq 1407776542, ack 1564709705, win 14180, options [mss 1430,sackOK,TS val 3721836586 ecr 33883552,nop,wscale 6], length 0
17:22:56.546799 IP (tos 0x58, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 40)
    192.168.1.105.42036 > fra07s07-in-f102.1e100.net.http: Flags [R], cksum 0xf301 (correct), seq 1564709705, win 0, length 0
17:22:58.511843 IP (tos 0x0, ttl 64, id 41584, offset 0, flags [DF], proto TCP (6), length 60)
    192.168.1.105.42036 > fra07s07-in-f102.1e100.net.http: Flags [S], cksum 0x27fc (incorrect -> 0x204f), seq 1564709704, win 13600, options [mss 1360,sackOK,TS val 33895445 ecr 0,nop,wscale 4], length 0
17:22:58.555423 IP (tos 0x58, ttl 54, id 65443, offset 0, flags [none], proto TCP (6), length 60)
    fra07s07-in-f102.1e100.net.http > 192.168.1.105.42036: Flags [S.], cksum 0x3b03 (correct), seq 1439178112, ack 1564709705, win 14180, options [mss 1430,sackOK,TS val 3721838596 ecr 33883552,nop,wscale 6], length 0
17:22:58.555458 IP (tos 0x58, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 40)
    192.168.1.105.42036 > fra07s07-in-f102.1e100.net.http: Flags [R], cksum 0xf301 (correct), seq 1564709705, win 0, length 0

ethtool 출력

ethtool -k wlan0:

Features for wlan0:
rx-checksumming: off [fixed]
tx-checksumming: off
  tx-checksum-ipv4: off [fixed]
  tx-checksum-unneeded: off [fixed]
  tx-checksum-ip-generic: off [fixed]
  tx-checksum-ipv6: off [fixed]
  tx-checksum-fcoe-crc: off [fixed]
  tx-checksum-sctp: off [fixed]
scatter-gather: off
  tx-scatter-gather: off [fixed]
  tx-scatter-gather-fraglist: off [fixed]
tcp-segmentation-offload: off
  tx-tcp-segmentation: off [fixed]
  tx-tcp-ecn-segmentation: off [fixed]
  tx-tcp6-segmentation: off [fixed]
udp-fragmentation-offload: off [fixed]
generic-segmentation-offload: off [requested on]
generic-receive-offload: on
large-receive-offload: off [fixed]
rx-vlan-offload: off [fixed]
tx-vlan-offload: off [fixed]
ntuple-filters: off [fixed]
receive-hashing: off [fixed]
highdma: off [fixed]
rx-vlan-filter: off [fixed]
vlan-challenged: off [fixed]
tx-lockless: off [fixed]
netns-local: on [fixed]
tx-gso-robust: off [fixed]
tx-fcoe-segmentation: off [fixed]
fcoe-mtu: off [fixed]
tx-nocache-copy: off
loopback: off [fixed]

iptables

# namei -l "$(command -v iptables)"
f: /sbin/iptables
drwxr-xr-x root root /
drwxr-xr-x root root sbin
lrwxrwxrwx root root iptables -> xtables-multi
-rwxr-xr-x root root   xtables-multi

# dpkg -S "$(command -v iptables)"
iptables: /sbin/iptables

# iptables -nvL
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
# iptables -t mangle -nvL
Chain PREROUTING (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination

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

Chain POSTROUTING (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
# iptables -t nat -nvL
Chain PREROUTING (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination

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

Chain POSTROUTING (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
# iptables -t security -nvL
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination

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

모듈 정보

# ethtool -i wlan0
driver: brcmsmac
version: 3.2.0-3-686-pae
firmware-version: N/A
bus-info: 0000:12:00.0
supports-statistics: no
supports-test: no
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: no

# modinfo brcmsmac
filename:       /lib/modules/3.2.0-3-686-pae/kernel/drivers/net/wireless/brcm80211/brcmsmac/brcmsmac.ko
license:        Dual BSD/GPL
description:    Broadcom 802.11n wireless LAN driver.
author:         Broadcom Corporation
alias:          pci:v000014E4d00000576sv*sd*bc*sc*i*
alias:          pci:v000014E4d00004727sv*sd*bc*sc*i*
alias:          pci:v000014E4d00004353sv*sd*bc*sc*i*
alias:          pci:v000014E4d00004357sv*sd*bc*sc*i*
depends:        mac80211,brcmutil,cfg80211,cordic,crc8
intree:         Y
vermagic:       3.2.0-3-686-pae SMP mod_unload modversions 686

없습니다 /sys/module/brcmsmac/parameters. 여기 내가 가진 것이 있습니다.

# tree /sys/module/brcmsmac
/sys/module/brcmsmac
├── drivers
│   └── pci:brcmsmac -> ../../../bus/pci/drivers/brcmsmac
├── holders
├── initstate
├── notes
├── refcnt
├── sections
│   └── __bug_table
└── uevent

일부 사이트는 실제로 작동합니다

dr 님이 제안한대로 다른 사이트를 시도했으며 실제로 놀랍게도 일부 사이트가 작동했습니다. 작동 한 호스트는 다음과 같습니다.

  • rambler.ru
  • google.ru
  • ya.ru
  • opennet.ru
  • tut.by
  • ro-che.info
  • yahoo.com
  • ebay.com

그리고 여기에없는 것들이 있습니다 :

  • vk.com
  • meta.ua
  • ukr.net
  • tenet.ua
  • prom.ua
  • reddit.com
  • github.com
  • stackexchange.com

네트워크 캡처

네트워크 캡처를 만들어 여기에 업로드했습니다 .



답변

제공 한 캡처 에서 두 번째 패킷의 SYN-ACK에 있는 타임 스탬프 에코 응답 이 첫 번째 패킷의 SYN에있는 TSVal과 일치하지 않으며 몇 초 뒤에 있습니다.

그리고 173.194.70.108과 209.85.148.100이 보낸 모든 TSecr이 모두 TSVal과 동일하고 관련이 없는지 확인하십시오.

TCP 타임 스탬프와 섞이는 것 같습니다. 그 원인을 알 수는 없지만 컴퓨터 외부에있는 것처럼 들립니다. 이 경우 라우터 재부팅이 도움이됩니까?

기계가 RST (세 번째 패킷)를 보내는 원인인지 모르겠습니다. 그러나 그것은 SYN-ACK을 좋아하지 않으며, 내가 찾을 수있는 유일한 잘못입니다. 내가 생각할 수있는 유일한 다른 설명은 RST를 보내는 기계가 아니지만 SYN-ACK와 RST 사이의 시간 차이가 주어진 경우 의심 스럽습니다. 그러나 경우에 따라이 머신에서 가상 머신 또는 컨테이너 또는 네트워크 네임 스페이스를 사용합니까?

TCP 타임 스탬프를 비활성화하여 이것이 도움이되는지 확인할 수 있습니다.

sudo sysctl -w net.ipv4.tcp_timestamps=0

따라서 이러한 사이트는 가짜 TSecr을 보내거나 나가는 TSVal 또는 들어오는 TSecr을 혼란스럽게하는 무언가 (가는 라우터 또는 투명 프록시) 또는 가짜 TCP 스택이있는 프록시가 있습니다. tcp 타임 스탬프를 엉망으로 만드는 이유 : 버그, 침입 탐지 회피, 너무 똑똑한 / 가짜 트래픽 쉐이핑 알고리즘. 그것은 이전에 들어 본 적이있는 것이 아닙니다 (그러나 나는 그 주제에 대해 전문가가 아닙니다).

추가 조사 방법 :

  • TPLink 라우터가 타임 스탬프를 망칠 수 있는지 확인하기 위해 외부 트래픽을 도우거나 캡처 할 수 있는지 확인하기 위해 재설정해야하는 이유를 비난하십시오.
  • TTL을 가지고 놀거나, 웹 서버가 수신 한 요청 헤더를 보거나, 죽은 웹 사이트를 요청할 때 동작을 확인하여 투명한 프록시가 있는지 확인하십시오.
  • 원격 웹 서버에서 트래픽을 캡처하여 엉망인 TSVal 또는 TSecr인지 확인하십시오.

답변

위의 잘못된 체크섬이 표시됩니다. 해당 장치에 대한 체크섬 오프로드가 있습니까 (무선 장치가 체크섬을 오프로드 할 수 있다는 것을 몰랐습니다).

무엇을 sudo ethtool -k wlan0말 합니까? 오프 로딩이 있으면 시도하여 비활성화 할 수 있습니다.

iptables-save를 호출하려면 루트 여야합니다. 여전히 무언가가 패킷을 망칠 가능성이 여전히 있습니다. 경우 iptables-save없는 작업을 수행, 시도 :

iptables -nvL
iptables -t mangle -nvL
iptables -t nat -nvL
iptables -t security -nvL

네트워크 캡처에서 대상 MAC 주소가 라우터의 MAC 주소와 일치합니까? UDP 트래픽과 TCP 트래픽을 비교할 때 흥미로운 점이 있습니까?

또한, 여기서 $dev커널 드라이버 (모듈) (참조입니다 ethtool -i wlan0무엇을, 무선 어댑터) modinfo "$dev"grep . /sys/module/"$dev"/parameters/*당신에게?


답변

내 노트북에서도 똑같은 동작하는 것 같습니다 . 이유를 모르지만 때때로 google.com 및 기타 외부 리소스에 연결할 수 없습니다. 핑 및 DNS 쿼리는 완벽하게 작동합니다. 또한 한 가지 해결책을 찾았습니다 : reboot .

몇 가지 관찰을 추가 할 수 있습니다.

  1. 내 가상 상자 (Windows, ArchLinux, Ubuntu)에서 다른 OS를 부팅하면 문제없이 호스트와 TCP 연결을 설정할 수 있습니다.
  2. 인터넷의 일부 호스트는 google.com처럼 동작하지만 일반적으로 telnet 또는 웹 브라우저를 사용하여 액세스 할 수있는 호스트가 많이 있습니다
  3. 랩톱에 WIFI 어댑터가없고 라우터에 대한 이더넷 링크 만 있습니다
  4. 데비안 / 젠투 사용자 공간으로 chroot하려고 시도했지만 도움이되지 않습니다.
  5. NIC를 새 것으로 교체했습니다. 도움이되지 않습니다.

내 상자에 대한 일부 기술 정보 :

운영체제 : Last ArchLinux amd64

$ ethtool -i  eth0
driver: via-rhine
version: 1.5.0
firmware-version:
bus-info: 0000:02:07.0
supports-statistics: no
supports-test: no
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: no

$uname -a
Linux eniac-2 3.5.4-1-ARCH #1 SMP PREEMPT Sat Sep 15 08:12:04 CEST 2012 x86_64 GNU/Linux

이 버기 동작은 일부 Linux 커널 버전의 미묘한 버그로 인해 발생하지만이 문제를 디버깅하는 방법을 모르고 불안정한 재생산으로 인해 멈추었습니다.


답변

/sbin/iptables -t mangle -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu

위의 명령을 인터넷 게이트웨이 iptables 명령에 추가 할 때까지 설명한 것과 동일한 문제가있었습니다 . In은 기본적으로 rp-pppoe 패키지 및 기타에 포함됩니다. 그러나 사용자 지정 구성으로 이동하여 수동으로 설정하지 않으면 게이트웨이 뒤에있는 LAN의 컴퓨터에 설명하는 문제가 있습니다.


답변