1

Is there a utility or linux built in to get the PMTU/MTU of a remote system quickly (sub 1 second preferably)? If so what is it and what syntax does it require?

Google searches have not been my friend today and the only solution I've found is a full blown traceroute which can take upwards of 30 seconds.

Bravo Delta
  • 140
  • 1
  • 9
  • PMTUD depends ICMP messages being returned when a packet is too big for a link in the path, or it depends on you increasing the packet size from a small size until no response is received from the other end. You can manually test the path MTU across a network with `tracepath`, but I doubt you are going to get sub-1s discovery with anything. – Ron Maupin Feb 02 '17 at 16:40
  • Related (not duplicate) question: http://networkengineering.stackexchange.com/questions/13417/exactly-when-is-pmtud-performed-path-mtu-discovery – Dan Pritts Feb 02 '17 at 18:03

2 Answers2

2

I found a solution after a lot of searching. Just going to link this here for anyone who cares:

https://github.com/ValdikSS/p0f-mtu

It has an API you can call with full socket support. So while technically it's a daemon it does the trick.

Bravo Delta
  • 140
  • 1
  • 9
1

Things I'd try:

  • Try this nmap script, which uses nmap to perform PMTUD. I haven't tried it, don't know how fast it is.

  • write a small program that opens a TCP connection with PMTUD enabled, and read the value back from the kernel. This could potentially be pretty quick. I don't know enough about how to do this to tell you more, but the question i linked to in my comment has some details that should help get you going in the right direction.

  • if you're limited to existing shell commands, try sending pings of different sizes in parallel. ping -M do -s 1472 remote-host will send a 1500-byte packet (1472 data bytes + ICMP & IP headers). -M do tells it to explicitly do PMTUD. http://muzso.hu/2009/05/17/how-to-determine-the-proper-mtu-size-with-icmp-pings

  • you mention traceroute - if you're trying to figure out where the MTU is limited, but want something faster than traceroute, try mtr; it sends a bunch of packets with different timeouts in parallel, rather than sequentially like traceroute does.

Unfortunately I don't have immediate access to any systems with differing MTUs, so my ability to experiment is limited.

Dan Pritts
  • 3,221
  • 26
  • 28