15

I have a network problem on my MacOS that i need to troubleshoot. I know that TCP socket has internal timeout that will close connection if remote party is not responding (but no graceful disconnect either). Is it any command/tool i can use to check exact value of this timeout(s)?

grigoryvp
  • 3,415
  • 11
  • 38
  • 58

4 Answers4

19

You can see all system-set tcp values with

$ sysctl net.inet.tcp

Interpreted from tcp_var.h, tcp_subr.c, and tcp_timer.c:

  • net.inet.tcp.keepidle = keepalive idle timer
  • net.inet.tcp.keepintvl = interval to send keepalives
  • net.inet.tcp.keepinit = timeout for establishing syn
  • net.inet.tcp.mssdflt = Default TCP Maximum Segment Size
  • net.inet.tcp.v6mssdflt = Default TCP Maximum Segment Size for IPv6
  • net.inet.tcp.minmss = Minmum TCP Maximum Segment Size
  • net.inet.tcp.minmssoverload = Number of TCP Segments per Second allowed to be under the MINMSS Size
  • net.inet.tcp.rfc1323 = Enable rfc1323 (high performance TCP) extensions
  • net.inet.tcp.rfc1644 = Enable rfc1644 (TTCP) extensions
  • net.inet.tcp.do_tcpdrain = Enable tcp_drain routine for extra help when low on mbufs
  • net.inet.tcp.pcbcount = Number of active PCBs
  • net.inet.tcp.icmp_may_rst = Certain ICMP unreachable messages may abort connections in SYN_SENT
  • net.inet.tcp.strict_rfc1948 = Determines if RFC1948 is followed exactly
  • net.inet.tcp.isn_reseed_interval = Seconds between reseeding of ISN secret
  • net.inet.tcp.background_io_enabled = Background IO Enabled
  • net.inet.tcp.rtt_min = min rtt value allowed
  • net.inet.tcp.randomize_ports = Randomize TCP port numbers
  • net.inet.tcp.tcbhashsize = Size of TCP control-block hashtable
  • net.inet.tcp.msl = Maximum segment lifetime
  • net.inet.tcp.always_keepalive = Assume SO_KEEPALIVE on all TCP connections
  • net.inet.tcp.broken_peer_syn_rxmit_thres = Number of retransmitted SYNs before TCP disables rfc1323 and rfc1644 during the rest of attempts
  • net.inet.tcp.pmtud_blackhole_detection = Path MTU Discovery Black Hole Detection
  • net.inet.tcp.pmtud_blackhole_mss = Path MTU Discovery Black Hole Detection lowered MSS

I believe by default 8 keepalives will be sent before the connection is closed if SO_KEEPALIVE is set. Times are in milliseconds.

fuzzyTew
  • 134
  • 1
  • 9
6

For linux you can use:

$ sysctl -a | grep net.ipv4
NMaslarski
  • 61
  • 1
  • 2
3

I'm not sure if this is what you're looking for, but you can check the keep-alive value with:

$ netstat -o
atx
  • 1,281
  • 1
  • 9
  • 25
1

Maybe unrelated, but works for me:

I'm trying to determine the ssh/tcp interactive timeout to one of our servers, so i just:

date; ssh host.domain 'sleep 10000'; date

example output:

Thu May 24 12:22:39 CEST 2018
packet_write_wait: Connection to 172.29.1.27 port 22: Broken pipe
Thu May 24 14:22:40 CEST 2018
huch
  • 131
  • 4