Menu
Coddy logo textTech

Same Switch, Other Subnet

Lesson 11 of 35 in Coddy's LAN Labs course.

Plugging two hosts into the same switch does not put them on the same network. The switch works at layer 2 and happily carries frames between them, but a host only sends to an address it believes is local. pc1 at 192.168.1.10/24 looks at 192.168.2.20, sees a foreign network, and reaches for its default gateway. With no gateway configured, the packet goes nowhere.

netlab says so directly: unreachable (different subnet, pc1 has no gateway). The fix is either a router between the networks, or, when the split was a typo, putting both hosts back in one subnet.

challenge icon

Challenge

Easy

pc1 is 192.168.1.10/24; pc2 was given 192.168.2.20/24 by mistake. Ping pc2 from pc1, move pc2 to 192.168.1.20/24, and ping again.

Expected output:

pc1 -> pc2: unreachable (different subnet, pc1 has no gateway)
pc2 eth0: 192.168.1.20/24 (mask 255.255.255.0, network 192.168.1.0/24)
pc1 -> pc2: reply from 192.168.1.20 (ttl=64)

Try it yourself

Terminal

All lessons in LAN Labs

Practice on your own: Terminal playground