Demo: Handling Traffic with Higher MTUs using ICMP Type 3 Code 4
In this demo, we will explore how to handle traffic with higher MTUs (Maximum Transmission Units) than what is accepted by a network using ICMP Type 3 Code 4. Specifically, we will use two Linux instances running on AWS to simulate this situation.
Background
When a packet is sent over a network, it is divided into smaller fragments if its size exceeds the Maximum Transmission Unit (MTU) of the network. However, if a router receives a fragmented packet that is larger than the MTU of the outgoing link, it sends an ICMP Type 3 Code 4 message back to the source, indicating that the packet is too big and needs to be fragmented further.
Demo Setup
To simulate this situation, we will use two Linux instances running on AWS. We will configure one instance as the source and the other as the destination, with a network path between them that has a smaller MTU than the packets being sent. We will then send packets with a higher MTU than the network path and observe the ICMP Type 3 Code 4 messages that are sent back to the source.
Procedure
Launch two Linux instances on AWS, with one instance acting as the source and the other as the destination.
Configure the network path between the two instances to have a smaller MTU than the packets being sent. This can be done by setting the MTU on the network interface of one or both instances to a smaller value.
Send packets with a higher MTU than the network path from the source to the destination. This can be done using the
pingcommand with the-soption to set the packet size.Observe the ICMP Type 3 Code 4 messages that are sent back to the source. These messages indicate that the packets are too big and need to be fragmented further.
Handle the ICMP Type 3 Code 4 messages by fragmenting the packets further or reducing their size. This can be done using the
ipcommand with thefragoption.
Code Blocks
# Set the MTU on the network interface of the source instance
$ sudo ip link set dev eth0 mtu 1300# Send a packet with a higher MTU than the network path from the source to the destination
$ ping -s 1400 destination_ip# Observe the ICMP Type 3 Code 4 messages that are sent back to the source
$ sudo tcpdump -i eth0 icmp# Handle the ICMP Type 3 Code 4 messages by fragmenting the packets further
$ sudo ip frag add 1400/1300In this demo, we have explored how to handle traffic with higher MTUs than what is accepted by a network using ICMP Type 3 Code 4. By simulating a network path with a smaller MTU than the packets being sent, we were able to observe the ICMP Type 3 Code 4 messages that were sent back to the source and handle them by fragmenting the packets further or reducing their size. This knowledge can be useful in troubleshooting network issues and optimizing network performance.