Search Our Database
How MTU (Maximum Transmitted Unit) affecting server connectivity
Introduction
This article explains how the Maximum Transmission Unit (MTU) affects server connectivity and provides steps for diagnosing and resolving MTU-related issues. The MTU defines the largest packet size that can be transmitted over a network without fragmentation. If two devices on a network have mismatched MTU sizes, it can lead to problems like packet loss, connectivity drops, or slow performance. This article will help system administrators and network engineers identify and fix MTU mismatches for improved network reliability.
Prerequisites
- Basic knowledge of network configuration.
- SSH access to the Server with root privileges
Step-by-Step Guide
Step 1: Understanding MTU and Its Impact
- The MTU determines the maximum size of a packet that can be sent in a single transmission. If the MTU size is too large for a network segment, the packet must be fragmented, leading to performance degradation.
- Packets larger than the network’s MTU will be broken into smaller segments, which can increase latency or even cause connectivity failures.
Step 2: Common Symptoms of MTU-Related Issues
- Slow or inconsistent network speeds.
- Packet loss or timeouts during large data transfers.
- VPN connections dropping unexpectedly.
- Web pages or services that partially load or fail to load entirely.
Step 3: Checking Your Current MTU Settings
To identify the current MTU value, you can run the following command:
Linux
ip a | grep mtu
Windows
netsh interface ipv4 show subinterfaces
The commands will display the current MTU setting for each network interface.
Step 4: Testing for MTU Mismatch Between Server A and Server B
You can test for MTU issues by sending ping requests with a specific packet size and sends a ping with the Don’t Fragment (DF) flag set, which tests whether packets are being fragmented.
Scenario:
Server A has an MTU of 1500, and Server B has an MTU of 1400.
- On Server A (MTU 1500), run the following ping command to Server B (MTU 1400):
Linux
ping -c 4 -M do -s 1372 server_b_ip
Here’s a breakdown of each part of the command:
- ping: Tests the connection between your device and the server.
- -c 4: Sends 4 ping requests to the server.
- -M do: Ensures packets are not fragmented (Path MTU Discovery enabled).
- -s 1372: Specifies the payload size as 1372 bytes
Windows
ping -f -l 1372 server_b_ip
Here’s a breakdown of each part of the command:
- ping: Sends ICMP echo request packets to a target IP address to test network connectivity.
- -f: Sets the Don’t Fragment flag, which ensures the packet cannot be fragmented.
- -l 1372: Specifies the packet size (in bytes).
- The ping is success, since Server B has an MTU of 1400, you subtract 28 bytes (ICMP header) from 1400 to get 1372. This shows that the packet size is within the limit of Server B’s MTU.
- On Server B, if the MTU is set lower (1400), pinging with a packet size that exceeds the MTU will result in fragmentation:
- This command will return the error “Frag needed and DF set” because Server B’s MTU cannot accommodate the larger packet size of Server A (1472 bytes).
Linux
ping -c 4 -M do -s 1472 server_a_ip
Windows
ping -f -l 1472 server_a_ip
Step 5: Adjusting the MTU Setting
If the ping failed, adjust the MTU on either server so they match, or choose an MTU that works for both (e.g., 1400), then rerun the ping tests to confirm the changes. By settings the MTU size in the network configuration, the server will know that the maximum transfer allowed so that packets will be fragmented to smaller pieces to avoid packet loss.
Linux
sudo ip link set dev eth0 mtu 1500
- Replace eth0 with the name of your network interface.
- Replace 1500 with the desired MTU size.
Windows
netsh interface ipv4 set subinterface "Ethernet" mtu=1500 store=persistent
- Replace 1500 with the desired MTU size.
Step 6: Verifying the Change
After adjusting the MTU size, verify the new setting by re-running the commands used to check the MTU in Step 3. You can also repeat the ping test to ensure that packet fragmentation no longer occurs.
Conclusion
The MTU plays a critical role in determining network performance. Incorrect MTU settings can cause packet loss, slow connectivity, or fragmented packets, negatively affecting your server’s performance. By properly adjusting the MTU size to match the network’s capability, you can optimize the connection and resolve many common network issues.
For additional assistance or if you encounter any issues, please contact our support team at support@ipserverone.com