July 15, 2023 · macos networking

MTU Size Test on macOS

Update Jan 2024: flags explained

The Maximum Transmission Unit (MTU) of a network path is the maximum size of data you can send in a packet from one place to another. Every hop in a network has its own MTU, while the path MTU represents the lowest compatible value in a network. In well behaving networks, IPv4 packets work reliably since they can be fragmented. Some routers also modify packets on the fly to adapt to differing sizes of MTU. But in situations where only a few certain websites are loading, an incompatible MTU can sometimes be the problem. Any size less than 1280 is non-standard, while 1500 is the most standard.

The MTU can be checked using the ping command on macOS. Start by running ping example.com -D -s 1472. The -D flag asks routers not to fragment the packet, the -s flag adds arbitrary padding. Experiment with the -s parameter to find the largest successful ping. Then, add 28 to the result for the MTU (20 bytes for the IPv4 header and 8 bytes for the ICMP echo header). Here is an example of MTU size 1500:

Successful ping:

yoonsik@macbook-air-d5 ~ % ping example.com -D -s 1472
PING example.com (93.184.216.34): 1472 data bytes
1480 bytes from 93.184.216.34: icmp_seq=0 ttl=57 time=22.916 ms
^C
--- example.com ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss

Unsuccessful ping:

yoonsik@macbook-air-d5 ~ % ping example.com -D -s 1473
PING example.com (93.184.216.34): 1473 data bytes
ping: sendto: Message too long
^C
--- example.com ping statistics ---
1 packets transmitted, 0 packets received, 100.0% packet loss

ping manual