Checking supported MTU (Maximum Transmission Unit) for a system using PING

When troubleshooting network issues, ensuring that packets are not being fragmented is crucial. One way to check the Maximum Transmission Unit (MTU) of a network path is by using the ping command with specific flags that test for fragmentation.

What is MTU?

MTU (Maximum Transmission Unit) is the largest size of a packet that can be sent over a network without fragmentation. If a packet exceeds the MTU, it is either fragmented or dropped (if fragmentation is disabled).

To determine the MTU value that works for your connection, you can use the ping command with the Don’t Fragment (DF) flag, ensuring that packets exceeding the MTU are rejected instead of being fragmented.

Using PING to check MTU

A simple way to test MTU is by sending a ping with a specified packet size and ensuring it does not get fragmented:

# ping 10.7.0.4 -c 2 -M do -s 1400

Where:

  • 10.7.0.4: The destination IP address to which we are sending the ping
  • -c 2: Sends 2 pings before stopping
  • -M do: Enables strict Path MTU Discovery, meaning fragmentation is not allowed
  • -s 1400: Sets the ICMP payload size to 1400 bytes. The total packet size will be:
    • 1400 bytes (payload) + 8 bytes (ICMP header) + 20 bytes (IP header) = 1428 bytes.

In the following example, we are successfully sending a packet with a size of 1400:

[root@rac1 ~]# ping 10.0.1.4 -c 2 -M do -s 1400
PING 10.0.1.4 (10.0.1.4) 1400(1428) bytes of data.
1408 bytes from 10.0.1.4: icmp_seq=1 ttl=63 time=0.726 ms
1408 bytes from 10.0.1.4: icmp_seq=2 ttl=63 time=0.720 ms

--- 10.0.1.4 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1046ms

Sending a packet of the size 1472 is also successful:

[root@rac1 ~]# ping 10.0.1.4 -c 2 -M do -s 1472
PING 10.0.1.4 (10.0.1.4) 1472(1500) bytes of data.
1480 bytes from 10.0.1.4: icmp_seq=1 ttl=63 time=0.780 ms
1480 bytes from 10.0.1.4: icmp_seq=2 ttl=63 time=0.759 ms

--- 10.0.1.4 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1034ms
rtt min/avg/max/mdev = 0.759/0.769/0.780/0.029 ms

But sending a packet with the size 1473 is not successful:

[root@rac1 ~]# ping 10.0.1.4 -c 2 -M do -s 1473
PING 10.0.1.4 (10.0.1.4) 1473(1501) bytes of data.

--- 10.0.1.4 ping statistics ---
2 packets transmitted, 0 received, 100% packet loss, time 1023ms

This indicates that the largest packet size you can send without fragmentation is 1472.

Virtualbox connect from host to guest via ssh and enable internet on guest

  1. Open Oracle VM Virtualbox Manager

    virtualbox_manager

  2. Place the cursor on the machine that you want to configure and press the button Settings.
    -> Network -> Adapter 1-> check Enable Network Adapter -> in Attached to choose NAT.
    -> in Advanced section -> press Port Forwarding  -> in Port Forwarding Rules, press addition button ->
    Fill the rule , by the following way:
    Host IP: (leave blank)
    Host Port: 22   (or any port that your host has free)
    Guest IP: (leave blank)
    Guest Port: 22

    vm_settings
    rules

  3. Start up the VM and connect to the guest using ssh.
    Hostname: localhost (or your machine name)
    Port: 22 (it is the same that we have indicated during rule configuration field Host Port)

    putty

  4. If you are not using proxy, than you can think that the post finished for you. You can connect to the guest from os and also you have an internet on your guest.

    But if proxy is used then you should configure parameter http_proxy.
    You can enter this variable information in every user’s  ~/.bash_profile or you can do it globally in /etc/profile file.

    #add the following entry in profile file

    [root@oracle01 ~]# vi /etc/profile
    export http_proxy=http://proxyservername.domain.ge:8080

    Logout and login for changes to take effect.