7

Actually my machine wwan0 MTU is 1500

ashokkrishna@ashokkrishna-Lenovo-B560:~$ ping -s 1490 example.com
PING example.com (93.184.216.119) 1490(1518) bytes of data.
1498 bytes from 93.184.216.119: icmp_seq=1 ttl=51 time=1119 ms
1498 bytes from 93.184.216.119: icmp_seq=2 ttl=51 time=1130 ms
1498 bytes from 93.184.216.119: icmp_seq=3 ttl=51 time=1260 ms
^C
--- example.com ping statistics ---
4 packets transmitted, 3 received, 25% packet loss, time 3178ms
rtt min/avg/max/mdev = 1119.258/1170.102/1260.574/64.137 ms, pipe 2

but when i ping like

ashokkrishna@ashokkrishna-Lenovo-B560:~$ ping -M do -s 1490 example.com
PING example.com (93.184.216.119) 1490(1518) bytes of data.
ping: local error: Message too long, mtu=1500
ping: local error: Message too long, mtu=1500
ping: local error: Message too long, mtu=1500
^C
--- example.com ping statistics ---
3 packets transmitted, 0 received, +3 errors, 100% packet loss, time 1999ms

what is this difference?
My intention is to know the example.com server's MTU size? how can I find that?

Mike Pennington
  • 29,876
  • 11
  • 78
  • 152
ashok
  • 585
  • 4
  • 7
  • 14
  • 1
    `-M do` is preventing fragmentation, even locally. That's why you're getting `local error: Message too long`. – Ryan Foley Nov 27 '14 at 13:32
  • even locally means my machine also don't fragment. am I right? – ashok Nov 27 '14 at 13:37
  • is there any option in ping tool (linux) which will put don't fragment bit set && do fragmentation locally. so that i may get MTU – ashok Nov 27 '14 at 13:41
  • `-M want` will fragment locally. – Ryan Foley Nov 27 '14 at 14:04
  • Hmm, ping from edge routers outside interface, so you bybass internal routes/next hop? Used to test MTU and set do not fragment bit many years ago..but out appliance was usually setup as the edge router.. – Sean Baker May 20 '19 at 15:45

2 Answers2

11

Running "ping -M do -s 1490 example.com" says that the ICMP data size is 1490 bytes and fragmentation is not allowed. For this size of ICMP data, ICMP size (i.e., header + data) is 1498 bytes. Adding IP header, frame size becomes 1518 bytes. Frame size can't exceed MTU size of the interface. As from the error message, MTU for the interface is 1500 bytes. So, there are extra 18 bytes in the frame. Without fragmentation, this message can't be sent. Since fragmentation is not allowed, ping fails saying message is too long.

You don't need remote server's MTU size. In networking, MTU sizes are needed only for the next hop (unless the destination is the next hop). Reading https://en.wikipedia.org/wiki/IP_fragmentation helps.

Gireesh
  • 153
  • 1
  • 5
3

When you specify "-s 1490" you set size of ICMP packet to 1490 bytes. Then the IP stack of your system adds ICMP and IP headers which equals to 28 bytes. So in this case while specifying size of 1490 bytes in fact your system tries to send IP packet of size 1490 + 28 = 1518 bytes. I assume that your PC has MTU 1500 on interface and as you already prohibited your system doing fragmentation it reports to you that packet is too big to be sent through interface with lower MTU.

Regarding your attempt of checking server's MTU size. Because of concerns above you will not be able to send IP packet bigger than 1500 bytes, so if server has higher MTU you won't be able to find this out from this PC.

Gireesh
  • 153
  • 1
  • 5
  • I understood that but I want to know the remote target server's MTU how can I know that. – ashok Jul 03 '15 at 14:57
  • Then you need to find a host which can send bigger IP packets, in this case you will be able to check server's MTU size up to the host's MTU size. I assume that you don't have management(CLI, SSH, RDP) access to server. – Mikhail Shchedrin Jul 06 '15 at 08:00