Here is a small network that trips up a lot of CCNA learners:
- PC1 and PC2 sit on the same switch, in the same VLAN, subnet 10.0.1.0/24.
- A router connects that LAN to a server at 10.0.2.10.
- PC1 reaches the server. PC2 does not.
- PC1 and PC2 can ping each other. Cables are fine. The router interfaces are up/up.
Before you read on, decide which one command you would run first.
Start where the symptom is
The symptom is on PC2, so start on PC2. A lot of people jump to the router and run show ip route, and the router's table is perfect, because the router is not the problem.
On PC2:
C:\> ipconfig IPv4 Address. . . . . . . . . . . : 10.0.1.12 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 10.0.1.254 Compare it with PC1:
C:\> ipconfig IPv4 Address. . . . . . . . . . . : 10.0.1.11 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 10.0.1.1 PC2's default gateway is 10.0.1.254. Nothing on the LAN owns that address. The router's LAN interface is 10.0.1.1.
Why PC1 and PC2 can still ping each other
When PC2 pings PC1 (10.0.1.11), it compares the destination with its own address and mask. Same network, so PC2 sends an ARP for 10.0.1.11 directly and never uses the gateway. That is why "they can ping each other" proves nothing about the gateway.
When PC2 pings the server (10.0.2.10), the destination is on a different network, so PC2 must hand the packet to its default gateway. It sends an ARP for 10.0.1.254, nobody answers, and the ping times out.
You can see this on PC2 with arp -a: there is an entry for PC1 and no entry for the gateway.
The fix, and how to prove it
Set PC2's default gateway to 10.0.1.1, then:
C:\> ping 10.0.2.10 The replies come back, and PC1 still works, so nothing else was broken along the way.
The habit to take from this
- Start on the device that has the symptom.
- Compare it with a device that works. The difference is usually the fault.
- "Same subnet works, different subnet fails" points at the gateway (or the mask) almost every time.
You can open this exact network and fix it yourself in the browser, nothing to install and no sign-up for this lab: the broken-gateway lab on zNetLaB.
Disclosure: I work on zNetLaB, a browser-based network simulator. The beginner labs are free.