Entity Opt Dell

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Friday, October 11, 2013

Linux server sends SYNACK packet only after receiving 8 SYN

Posted on 8:39 AM by Unknown
Got a really weird issue recently, in some rare case (mostly Mac and Mobile phone clients), the connection to a linux server was really really slow (about 12s).

The issue was not only impacting Apache but all TCP services like SSH, hence it was not a particular service issue/misconfiguration.

The Chrome console on a MacBook Pro showed that the initial connection took about 10s, on the other hand a Win7 client in the same LAN had no problem at all.

After some digging on the client and server side, I found out that the client needs to send 8 SYN packets before the server replies with a SYNACK which explain why the connexion is so slow. Once the SYNACK is send back to the client, the communication speed is back to normal.

One hour headache later, it turn out that I enabled some Sysctl TCP tunning values that somehow introduced the issue.

I disabled the net.ipv4.tcp_tw_recycle and net.ipv4.tcp_tw_reuse features and everything went back to normal.

I think the problem comes from the net.ipv4.tcp_tw_reuse option, but as the issue impacted a production service (and is really hard to reproduce) I didn't try to re-enable tcp_tw_recycle.

Some posts advice to disable window scaling, I strongly disencourage this as it would result in poor network performances.

Hope that helps !

Below the tcpdump output that shows the 8 client's SYN packets before the SYNACK is sent back. Test was performed on SSH service as you can see, the TCP handshake took 10 secondes.

 # SYN 1  
15:57:26.303076 IP (tos 0x0, ttl 53, id 9488, offset 0, flags [DF], proto TCP (6), length 64)
client_ip.49316 > server_ip.ssh: Flags [S], cksum 0xdf5f (correct), seq 2356956535, win 65535, options [mss 1460,nop,wscale 4,nop,nop,TS val 835124724 ecr 0,sackOK,eol], length 0
# SYN 2
15:57:27.306416 IP (tos 0x0, ttl 53, id 37141, offset 0, flags [DF], proto TCP (6), length 64)
client_ip.49316 > server_ip.ssh: Flags [S], cksum 0xdb71 (correct), seq 2356956535, win 65535, options [mss 1460,nop,wscale 4,nop,nop,TS val 835125730 ecr 0,sackOK,eol], length 0
15:57:28.315804 IP (tos 0x0, ttl 53, id 2415, offset 0, flags [DF], proto TCP (6), length 64)
# SYN 3
client_ip.49316 > server_ip.ssh: Flags [S], cksum 0xd785 (correct), seq 2356956535, win 65535, options [mss 1460,nop,wscale 4,nop,nop,TS val 835126734 ecr 0,sackOK,eol], length 0
15:57:29.330233 IP (tos 0x0, ttl 53, id 62758, offset 0, flags [DF], proto TCP (6), length 64)
# SYN 4
client_ip.49316 > server_ip.ssh: Flags [S], cksum 0xd398 (correct), seq 2356956535, win 65535, options [mss 1460,nop,wscale 4,nop,nop,TS val 835127739 ecr 0,sackOK,eol], length 0
15:57:30.335779 IP (tos 0x0, ttl 53, id 29003, offset 0, flags [DF], proto TCP (6), length 64)
# SYN 5
client_ip.49316 > server_ip.ssh: Flags [S], cksum 0xcfa9 (correct), seq 2356956535, win 65535, options [mss 1460,nop,wscale 4,nop,nop,TS val 835128746 ecr 0,sackOK,eol], length 0
15:57:31.345254 IP (tos 0x0, ttl 53, id 5246, offset 0, flags [DF], proto TCP (6), length 64)
# SYN 6
client_ip.49316 > server_ip.ssh: Flags [S], cksum 0xcbba (correct), seq 2356956535, win 65535, options [mss 1460,nop,wscale 4,nop,nop,TS val 835129753 ecr 0,sackOK,eol], length 0
15:57:33.382242 IP (tos 0x0, ttl 53, id 5958, offset 0, flags [DF], proto TCP (6), length 64)
# SYN 7
client_ip.49316 > server_ip.ssh: Flags [S], cksum 0xc3dc (correct), seq 2356956535, win 65535, options [mss 1460,nop,wscale 4,nop,nop,TS val 835131767 ecr 0,sackOK,eol], length 0
15:57:37.881881 IP (tos 0x0, ttl 53, id 21274, offset 0, flags [DF], proto TCP (6), length 48)
# SYN 8
client_ip.49316 > server_ip.ssh: Flags [S], cksum 0x5c3d (correct), seq 2356956535, win 65535, options [mss 1460,sackOK,eol], length 0
15:57:37.881907 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 48)
# SYNACK (at last !!!)
server_ip.ssh > client_ip.49316: Flags [S.], cksum 0x7a12 (correct), seq 3228952474, ack 2356956536, win 14600, options [mss 1460,nop,nop,sackOK], length 0
15:57:37.885362 IP (tos 0x0, ttl 53, id 62772, offset 0, flags [DF], proto TCP (6), length 40)
# ACK
client_ip.49316 > server_ip.ssh: Flags [.], cksum 0xdfde (correct), seq 1, ack 1, win 65535, length 0

Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Posted in Bugs, Kernel, Linux, Network, Performances, System | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • Microsoft Silverlight update repeatedly fails to install with error 0x80070643
    The Problem My wife made me aware that she always had one update to install while shutting down her computer. Being an IT guy by day, it too...
  • Choosing RAID Level / Stripe Size
    Below interesting articles on how to choose your RAID level / stripe size. Good litterature on RAID : http://www.fccps.cz/download/adv/frr/h...
  • Bash : Wait for a command with timeout
    Here is a very useful little command that wait for a process to finish and kill it if doesn't exit after a pre defined timeout. The comm...
  • Shrew VPN Client + Juniper SRX : "session terminated by gateway" (Autodisconnect)
    If like me, you're trying to connect to a Juniper dynamic VPN with Shrew VPN Client, be aware that this not yet possible. The connection...
  • IE8 Strikes again
    Summary: My wife tells me that the internet seems slow on our Desktop at home. She says it seems to get worse using 2 tabs. After using it ...
  • IE8 Error while installing. "Setup cannot continue because..."
    The Problem I was installing updates on a laptop running Vista x64. Mid install of updates it rebooted and then told me it was uninstalling ...
  • Word could not create the work file. Check the temp environment variable.
    A friend of me contacted me and let me know that he was constantly getting an error while opening word, which said "Word could not crea...
  • IP Office with 9600 phones Waiting for LLDP
    At work we had setup the Avaya IP Office R6.0. When we purchased it we also purchased 5621 phones. I was asked to purchase some addition pho...
  • Remote Assistance, VNC, and UAC Prompts
    Intro Many of us as tech professionals are quite busy and reducing time doing unnecessary tasks is necessary so we can still complete the ev...
  • Juniper JunOS transfer on commit fails
    I had quite a surprise when I discover that my transfer on commit stopped working on my SRX firewall. The error in the logfile was : ACCT_X...

Categories

  • 007
  • 7
  • A+
  • Academic
  • Anti Virus
  • Antivirus Live
  • Avaya
  • AverPen
  • Bash
  • Begin
  • broken
  • Bugs
  • CentOS
  • CentOS 6.3
  • Centos 6.4
  • Certifications
  • CIP
  • ClamAV
  • Clean Slate
  • cli
  • CompTIA
  • Dead
  • Deal
  • Dell
  • Desktops
  • DHCP
  • Digital Camera
  • EBS
  • Error
  • Exchange 2007
  • fail
  • fax
  • File Systems
  • Firefox
  • Firewall
  • Fix
  • Flashback
  • FMTG
  • Fraud
  • FTP
  • GPO
  • Hard drive
  • Hardware
  • ICOP
  • IE8
  • Imaging
  • In-Car Video
  • Internet
  • Internet Explorer
  • IPO
  • ISA
  • Juniper
  • Kernel
  • Kodak
  • License
  • Linux
  • Microsoft
  • Microsoft Office
  • NERC
  • Network
  • Network+
  • Networking
  • NFS
  • Office 2010
  • OpenManage
  • Outlook2010
  • PDF
  • Performances
  • Phones
  • Ports
  • Presentation
  • printer
  • Protection
  • RAID
  • Remote
  • Renewal
  • Scam
  • SCE
  • Script
  • Security
  • Security+
  • Services
  • Shell
  • Shrew
  • Silverlight
  • SMS
  • SRX
  • SteadyState
  • Symantec
  • sysinternals
  • System
  • Tech
  • Text
  • Timer
  • Times Up
  • Tip
  • UAC
  • Unbootable
  • update
  • Virus
  • Virus Removal
  • VPN
  • Whiteboard
  • Windows
  • Windows 8
  • Windows Phone
  • Windows Server
  • Windows Update
  • Wireless
  • WSUS
  • Yahoo
  • Zabbix

Blog Archive

  • ▼  2013 (36)
    • ▼  October (5)
      • Microsoft Silverlight update repeatedly fails to i...
      • Easy way to find your public IP in scripts or CLI
      • Dell Firmware update fails with "mktemp: too many ...
      • Linux server sends SYNACK packet only after receiv...
      • Juniper JunOS transfer on commit fails
    • ►  September (1)
    • ►  August (1)
    • ►  July (4)
    • ►  June (2)
    • ►  May (12)
    • ►  April (6)
    • ►  March (2)
    • ►  February (1)
    • ►  January (2)
  • ►  2012 (9)
    • ►  September (1)
    • ►  April (3)
    • ►  March (1)
    • ►  January (4)
  • ►  2011 (18)
    • ►  December (2)
    • ►  November (1)
    • ►  October (1)
    • ►  September (3)
    • ►  August (2)
    • ►  July (1)
    • ►  May (1)
    • ►  March (1)
    • ►  February (2)
    • ►  January (4)
  • ►  2010 (13)
    • ►  December (2)
    • ►  November (1)
    • ►  October (2)
    • ►  August (2)
    • ►  March (1)
    • ►  February (3)
    • ►  January (2)
  • ►  2009 (7)
    • ►  December (2)
    • ►  October (4)
    • ►  September (1)
Powered by Blogger.

About Me

Unknown
View my complete profile