ICMP Type 3 Code 4 Demo: Handling Traffic with Higher MTUs

Abstract: Resolve ICMP Type 3 Code 4 errors by identifying the path MTU bottleneck and adjusting packet sizes to prevent fragmentation failures.

Created: 2026-08-11 by

An ICMP Type 3 Code 4 message indicates that a packet was fragmented but the "Don't Fragment" (DF) flag was set, preventing the router from splitting it further. This error occurs when a sender transmits packets larger than the path's Maximum Transmission Unit (MTU). To resolve this, you must identify the correct MTU using diagnostic tools and adjust your network interface or application settings to match the bottleneck.

The Mechanics of Path MTU Discovery

When two Linux instances communicate over a network, such as within an Amazon Web Services (AWS) environment, they rely on the Internet Control Message Protocol (ICMP) to manage packet sizes. The process begins with Path MTU Discovery (PMTUD), where the source host attempts to send packets with the DF flag enabled. Routers along the path check if the packet size exceeds their outgoing interface MTU. If it does, and fragmentation is blocked by the DF flag, the router drops the packet and sends back an ICMP Type 3 Code 4 response. This response contains crucial information: the IP address of the router that dropped the packet and the maximum transmission unit size supported by that specific hop. Without this feedback, the sender would either flood the network with oversized packets or unnecessarily reduce its payload size, wasting bandwidth. Understanding this interaction is vital for maintaining efficient data transfer between cloud instances. For more context on how traffic moves through networks, you might find Understanding Packet Forwarding vs Local Delivery in Network Routing helpful, as it clarifies the distinction between transit and final delivery.

Reproducing the Error in AWS

To demonstrate this issue, we use two Linux instances in the same Virtual Private Cloud (VPC). First, determine the default MTU of your interfaces, which is typically 9001 bytes for AWS eni interfaces supporting jumbo frames, or 1500 bytes for standard Ethernet. We will simulate a scenario where one instance tries to send a packet larger than the receiving path can handle without fragmentation. Use the ping command with the -M do flag to enforce the DF bit. For example, attempting to ping the remote instance with a large payload:
ping -M do -s 1500 <remote_instance_ip>
If the path includes a device with a lower MTU limit (such as a NAT gateway or a security appliance configured with stricter limits), the ping will fail. You will not see a timeout; instead, you will receive an immediate error message indicating that the operation requires fragmentation but the DF flag is set. This is the practical manifestation of the ICMP Type 3 Code 4 error.

Detecting the Bottleneck

When the connection fails, the next step is to isolate the exact point of failure. While the ICMP message provides the MTU limit, it does not always clearly indicate which intermediate hop caused the drop if multiple routers are involved. A systematic approach involves reducing the packet size incrementally until the communication succeeds. Start with a payload size slightly above the suspected bottleneck. If the ping fails, reduce the size by 10-20 bytes and try again. Continue this binary search or linear reduction until you find the largest packet size that passes through successfully. This value represents the Path MTU. You can also use traceroute combined with varying packet sizes to observe where the silence occurs. Note that some firewalls block ICMP messages entirely, which can lead to black holes where no error is returned. In such cases, PMTUD fails silently, leading to TCP timeouts rather than explicit ICMP errors.

Configuring the Fix

Once you have identified the optimal MTU, you must configure your Linux instances to adhere to this limit. There are two primary methods: adjusting the network interface MTU or configuring the application to respect the path limit. For network-level adjustments, use the ip command to change the MTU of the interface:
sudo ip link set dev eth0 mtu 1450
Replace eth0 with your actual interface name and 1450 with the discovered safe MTU. This change persists only until the next reboot unless added to your network configuration files (e.g., /etc/network/interfaces or Netplan configurations). Alternatively, if you are running applications like web servers or database clusters, configure them to use smaller TCP segments. For TCP connections, the effective MTU is often reduced by headers (IP + TCP + ICMP overhead). A common safe MTU for IPv4 over standard internet links is 1460 bytes for payload, accounting for 40 bytes of header overhead. If you are dealing with complex routing scenarios involving multiple machines, reviewing Troubleshooting Traffic Forwarding with Multiple Machines on a LAN can provide additional insights into how different nodes handle these constraints.

Verifying the Solution

After applying the MTU changes, verify the connectivity using the same ping command with the -M do flag and the newly calculated payload size. The ping should succeed consistently. Additionally, monitor the connection using tcpdump to ensure that no ICMP errors are being generated during high-throughput transfers.
tcpdump -i eth0 icmp
If you see ICMP Type 3 Code 4 messages disappearing, your configuration is correct. Remember that MTU settings are per-interface and per-route. If you have multiple routes or bonding interfaces, ensure all relevant paths are adjusted. In AWS, remember that VPC peering or Transit Gateway attachments may have their own MTU constraints that differ from the instance level. Always test end-to-end performance after making changes to ensure that latency has not increased due to excessive segmentation.

Frequently Asked Questions

Why does my connection time out instead of showing an ICMP error?

Some firewalls or security groups are configured to drop ICMP messages entirely to prevent reconnaissance. When these blocks are in place, the sender never receives the Type 3 Code 4 reply, causing TCP sessions to hang until they timeout. You can detect this by checking if other protocols return errors while TCP stalls.

Can I increase the MTU beyond 1500 bytes in AWS?

Yes, AWS supports jumbo frames up to 9001 bytes for most instance types and ENI configurations. However, both the sending and receiving instances must support jumbo frames, and any intermediate networking equipment must also allow larger packets. If any hop in the path restricts the size, the effective MTU drops to the lowest common denominator.

What is the difference between ICMP Type 3 Code 4 and Code 13?

Type 3 Code 4 specifically means "Fragmentation Needed and Don't Fragment was Set." Code 13 refers to "Administratively Prohibited," which indicates that a firewall or access control list blocked the packet. Code 4 is a technical limitation of path capacity, while Code 13 is a policy-based rejection.

How do I check the current MTU of a remote server?

You cannot directly query a remote server's interface MTU via ICMP. Instead, you must perform Path MTU Discovery by sending progressively smaller packets with the DF flag set until one succeeds. The size of the largest successful packet minus header overhead gives you the path MTU.

Does changing the MTU affect TCP throughput?

Setting the MTU too low increases header overhead, reducing effective throughput. Setting it too high causes fragmentation issues if the path cannot handle it, leading to packet loss and retransmissions. Finding the optimal MTU ensures that each packet carries maximum useful data without requiring fragmentation, thus maximizing efficiency.

Tags: ICMP MTU Linux AWS

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More