Networking guides, explanations and reader checklists on whilenetworking.com

Wireshark Debug: Analyze ICMP Unreachable Messages to Identify Misconfigured Subnet Masks and Routing Loops

In the realm of network troubleshooting, few symptoms are as deceptive as an "Unspecified error" or a sudden drop in connectivity that isn't immediately…

In the realm of network troubleshooting, few symptoms are as deceptive as an “Unspecified error” or a sudden drop in connectivity that isn’t immediately obvious from ping sweeps. Often, the culprit lies deep within the lower layers of the OSI model, specifically in how devices interpret IP addresses and route packets. Two of the most common root causes for these silent failures are misconfigured subnet masks and routing loops. Both issues frequently manifest as ICMP Type 3 (Destination Unreachable) messages. By leveraging Wireshark to dissect these specific error packets, technicians can pinpoint whether a host believes it is on a different network than its gateway or if packets are bouncing endlessly through the network fabric before being dropped.

This guide walks you through a concrete lab scenario using Cisco Packet Tracer and a simulated Wireshark analysis environment. We will examine how to interpret ICMP unreachable codes, distinguish between “Network Unreachable,” “Host Unreachable,” and “Fragmentation Needed,” and apply this knowledge to resolve subnetting errors and loop-induced failures.

Understanding ICMP Type 3 Codes in Wireshark

Before diving into the lab, it is essential to understand what you are looking at. When a device cannot reach a destination, it typically sends an ICMP Destination Unreachable message back to the source. In Wireshark, these appear as ICMP: Destination Unreachable.

The second byte of the ICMP header indicates the specific reason:
* Code 0 (Network Unreachable): The router or host has no route to the entire network portion of the destination IP. This often points to a subnet mask mismatch where the device thinks the target is on a remote network but cannot find a gateway for it, or the gateway itself doesn’t know how to reach that subnet.
* Code 1 (Host Unreachable): The router knows the network exists but has no ARP entry or route for the specific host IP. This is common with misconfigured VLANs or DHCP failures where the MAC address table is incomplete.
* Code 2 (Protocol Unreachable): No protocol exists at that layer to handle the packet (e.g., trying to send a TCP packet when only ICMP is allowed).
* Code 3 (Fragmentation Needed and DF Set): The packet size exceeds the MTU of a link, and the “Don’t Fragment” flag was set.

Scenario A: Identifying Misconfigured Subnet Masks

Imagine you are configuring a small office network using Cisco Packet Tracer. You have two PCs, PC-A and PC-B, connected to different switches but intended to be on the same logical segment. However, connectivity fails. You suspect a subnet mask issue.

The Lab Setup

  1. PC-A Configuration: IP Address 192.168.10.5, Subnet Mask 255.255.255.0 (/24), Default Gateway 192.168.10.1.
  2. PC-B Configuration: IP Address 192.168.10.20, but the subnet mask is incorrectly set to 255.255.0.0 (/16).
  3. Gateway: A router interface connected to 192.168.10.1.

The Problem

PC-B believes that any IP address starting with 192.168.x.x is on its local network because of the /16 mask. However, PC-A is strictly adhering to a /24 mask. When PC-A sends a packet to PC-B, it checks its own routing table. Since PC-A’s subnet mask restricts its view of the local network to 192.168.10.0/24, and assuming the switch VLAN configuration is correct, the traffic should be local. However, if there are other subnets involved or if the gateway logic gets confused by the mismatched masks during broadcast calculations, strange behavior occurs.

More commonly in a real-world scenario involving routers: If PC-B has a mask of 255.255.0.0 and receives a packet intended for 192.168.10.5, it might assume 192.168.10.5 is local. But if the router interface is configured with /24 and PC-B attempts to send traffic that requires gateway intervention due to its own miscalculation of broadcast domains, the router may drop packets destined for addresses outside its defined subnet range.

Wireshark Analysis Steps

  1. Open Wireshark on a mirror port or a third PC in the same VLAN.
  2. Start capturing traffic on the eth0 interface.
  3. Attempt to ping from PC-A (192.168.10.5) to PC-B (192.168.10.20).
  4. Stop capture and apply a filter: icmp.type == 3.

Expected Results and Interpretation

In the packet details pane, you will see an ICMP message with Type 3. Click on it to expand the “ICMP” section. Look at the “Code” field.
* If the Code is 0, the device receiving the packet (likely the router or PC-B acting as a host) determined that the destination network is unreachable based on its routing table derived from its subnet mask.
* Illustrative Output:
text
Internet Control Message Protocol (ICMP)
Type: Destination Unreachable (3)
Code: Network Unreachable (0)
Reason: No route to destination network defined by interface mask

Fixing the Issue

The solution is straightforward: correct the subnet mask on PC-B to match the network design (255.255.255.0). Once corrected, rerun the ping test. The ICMP unreachable messages should cease, and Echo Reply packets will appear in the capture. Always verify that all devices in a broadcast domain share the same subnet mask.

Scenario B: Detecting Routing Loops via Time-to-Live (TTL) Decay

While subnet masks cause immediate drops, routing loops often create a different signature. A routing loop occurs when two or more routers forward packets to each other indefinitely because of incorrect static routes or dynamic routing protocol inconsistencies.

The Lab Setup

Create a topology with three routers: R1, R2, and R3.
* R1 has a static route pointing 10.0.0.0/8 via R2.
* R2 has a static route pointing 10.0.0.0/8 via R3.
* R3 has a static route pointing 10.0.0.0/8 via R1 (creating a loop).

The Problem

When you ping an IP in the 10.0.0.0/8 range from PC-A, the packet enters the loop and bounces between R1, R2, and R3 until the Time-to-Live (TTL) value reaches zero. At that point, the router discards the packet and sends an ICMP “Time Exceeded” message. However, if the loop eventually hits a gateway that determines the destination is truly unreachable due to the lack of a final exit route, you may also see ICMP Type 3 messages mixed in.

Wireshark Analysis Steps

  1. Enable IP Timestamping on your source host (optional but helpful for analysis).
  2. Capture traffic and filter for icmp.type == 3 or ip.ttl == 0.
  3. Analyze the sequence of ICMP packets. A routing loop often generates a high volume of “Time Exceeded” messages, but if the destination is ultimately unreachable, you will see Type 3 codes.

Identifying the Loop

Look at the TTL value in the IP header of outgoing Echo Request packets versus incoming responses. In a healthy network, the TTL decreases by 1 at each hop. If you see a sudden spike in ICMP messages with Code 11 (Time Exceeded) or Code 0/1 (Unreachable) originating from multiple interfaces within seconds, a loop is likely present.

Fixing the Issue

Review the static route configurations on R1, R2, and R3. Ensure that routes do not point back to each other without a valid exit path. If using dynamic protocols like OSPF or EIGRP, check for routing loops caused by incorrect metric calculations or missing default routes.

Common Mistakes and Verification Checklist

When analyzing ICMP unreachable messages in Wireshark, practitioners often make these errors:
* Ignoring the Interface: Assuming the error comes from the destination host when it actually originates from an intermediate router. Always check the Source IP of the ICMP response; it should match the gateway or next-hop router, not necessarily the final destination host if a loop exists.
* Confusing “Host Unreachable” with “Network Unreachable”: Ensure you are looking at the Code field. Network unreachable implies a routing table issue regarding the subnet prefix, while host unreachable implies an ARP failure on the local segment.
* Overlooking MTU Issues: Sometimes what looks like a routing error is simply a fragmentation issue. Check for ICMP Type 3 Code 4 (Fragmentation Needed).

Verification Checklist

Before concluding a configuration change is necessary, perform these steps:
1. [ ] Verify the subnet mask on all hosts matches the network design document.
2. [ ] Run ping from multiple sources to rule out a single bad cable or port.
3. [ ] Check router routing tables (show ip route) for recursive loops or missing gateways.
4. [ ] Confirm VLAN assignments align with IP subnets.
5. [ ] Review firewall logs on intermediate devices to ensure they aren’t silently dropping packets that Wireshark interprets as unreachable.

Conclusion and Student Practice Task

Analyzing ICMP unreachable messages is a critical skill for any network engineer. By understanding the difference between a simple subnet mask mismatch, which causes immediate “Network Unreachable” errors, and complex routing loops that degrade performance over time, you can troubleshoot networks more effectively using tools like Wireshark and Cisco Packet Tracer.

Student Practice Task:
Set up a Packet Tracer lab with two PCs and one router. Configure PC-A with IP 192.168.1.10/24 and PC-B with IP 192.168.2.10/24. Initially, configure the router interface connecting them with a mask of 255.255.255.0. Attempt to ping between PCs. Observe the ICMP Type 3 messages in Wireshark. Then, adjust one PC’s subnet mask to /16 while keeping the network prefix different, and observe how the unreachable message code changes. Finally, correct both configurations to match a proper design where all devices share the same subnet and gateway, verifying that ping succeeds without error messages. This exercise solidifies the relationship between IP addressing schemes and ICMP error reporting.

Educational-use notice: This tutorial is for learning and controlled lab use only. Test carefully, use backups, and obtain authorization before making changes. Do not run unfamiliar commands on production systems. We accept no responsibility for misuse, damage, data loss, or production issues.