Packet Walk: What Happens When You Ping Across VLANs
One ping across two VLANs touches ARP, 802.1Q tags, routing tables, and MAC rewriting. Follow a packet hop by hop — and learn where each stage can break.
The office mail-room analogy
Think of two office floors that share one mail room. VLAN 10 is floor 10, VLAN 20 is floor 20. Your PC is a worker on floor 10 who wants to send a letter to a colleague on floor 20. You address the envelope (the IP packet — the letter, with source and destination IP addresses) to your colleague, but you hand it to the mail room (your default gateway — the router) with the mail room's name on the outer courier pouch (the Ethernet frame — the pouch, with source and destination MAC addresses). Between floors, the pouch gets a colored sticker saying which floor it belongs to (the 802.1Q tag — 4 extra bytes switches add on trunk links). At each stop the pouch is re-addressed, but your letter inside is never rewritten.
Watch: the packet's journey
The setup
PC1 lives in VLAN 10 (192.168.10.50/24) and PC2 in VLAN 20 (192.168.20.50/24). A router-on-a-stick (one physical router interface split into virtual subinterfaces, one per VLAN) does inter-VLAN routing: gateway 192.168.10.1 on VLAN 10, 192.168.20.1 on VLAN 20. You type ping 192.168.20.50 on PC1. Walk with the packet.
Step 1: The host does the subnet math
PC1 ANDs the destination with its own mask and discovers 192.168.20.0/24 ≠ 192.168.10.0/24 — so the destination is remote. (Think of it as checking the ZIP code: same ZIP, walk it over; different ZIP, take it to the mail room.) Rule: for remote destinations, send the frame to your default gateway's MAC address, with the packet's destination IP remaining 192.168.20.50. (Not sure about the /24 math? Run the numbers in the subnet calculator.)
If PC1's ARP table (the PC's cheat-sheet mapping IP addresses to MAC addresses) lacks the gateway, it broadcasts ARP "who has 192.168.10.1?" on VLAN 10, and the router replies:
Step 2: The switch tags it
PC1's access port (a switch port belonging to exactly one VLAN) admits the frame into VLAN 10 untagged. To reach the router through the trunk, the switch adds the VLAN 10 tag. The tagged frame crosses the trunk; the router's subinterface for VLAN 10 pops the tag and hands the IP packet to the router's forwarding plane.
Step 3: The router forwards
The router looks up 192.168.20.50: longest-prefix match (the router picks the most specific matching route) says VLAN 20 subinterface. It builds a new frame — source MAC = router's VLAN-20 MAC, destination MAC = PC2's (ARP again if needed), 802.1Q tag VLAN 20 — and sends it down the trunk. The switch strips the tag at PC2's access port. The echo reply reverses the whole sequence.
Read it yourself: the two packets that start everything
Before the first ICMP echo can leave PC1, two packets hit the wire: the ARP request and the echo request itself. Here they are, byte by byte:
offset 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 0000 00 01 08 00 06 04 00 01 02 42 ac 11 00 02 c0 a8 0010 0a 32 00 00 00 00 00 00 c0 a8 0a 01
Bytes 0–1 · Hardware type: 0x0001 = Ethernet
ARP can map addresses for many link types; 1 means Ethernet.
Bytes 2–3 · Protocol type: 0x0800 = IPv4
We're resolving an IPv4 address. (0x86dd would mean IPv6 — but IPv6 doesn't use ARP at all; it uses Neighbor Discovery.)
Bytes 4–5 · Lengths: hw=6, proto=4
MAC addresses are 6 bytes, IPv4 addresses 4 bytes.
Bytes 6–7 · Opcode: 0x0001 = request
1 = "who has?", 2 = "here I am" (reply). Gratuitous ARPs — opcode 2 sent unprompted — are how devices announce "this IP is now at my MAC," and also how ARP spoofing attacks work.
Bytes 8–17 · Sender MAC + IP: 02:42:ac:11:00:02, 192.168.10.50
"Tell 192.168.10.50" — PC1 introduces itself so the router can reply unicast instead of broadcasting back.
Bytes 18–27 · Target MAC (all zeros) + IP 192.168.10.1
The target MAC is zeros because that's the question — PC1 doesn't know it yet. The Ethernet header wrapping this has destination ff:ff:ff:ff:ff:ff, the broadcast address.
offset 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 0000 08 00 4d 5e 00 01 00 07 61 62 63 64 65 66 67 68 0010 69 6a 6b 6c 6d 6e 6f 70 71 72 73 74 75 76 77 78 0020 79 7a 30 31 32 33 34 35
Bytes 0–1 · Type 8, Code 0 = echo request
ICMP (Internet Control Message Protocol — the network's own signaling channel) type 8 means "ping request"; the reply will be type 0. Filter icmp.type == 8 in Wireshark to see only requests.
Bytes 2–3 · Checksum: 0x4d5e
Covers the ICMP message so corruption is caught. A wrong checksum here means the packet is silently dropped.
Bytes 4–7 · Identifier 1, Sequence 7
The identifier and an incrementing sequence number let ping match each reply to its request and report per-packet RTT.
Bytes 8–39 · Payload: "abcdefghijklmnopqrstuvwyz012345"
Just filler so the packet has measurable size — 32 bytes here. Round-trip time is measured against this payload's return.
Where this breaks (the real reason to learn it)
| Symptom | Suspect | One command |
|---|---|---|
| "Destination host unreachable" instantly | No route / no gateway configured | ip route / route print |
| Ping fails, gateway ARP incomplete | VLAN mismatch on trunk, or native VLAN disagreement (the one VLAN a trunk carries untagged — both ends must agree) | show interfaces trunk |
| Same-VLAN works, cross-VLAN fails | No IP routing on L3 switch; subinterface down | show ip interface brief / show vlan |
| SVI is down/down (a switch virtual interface — the VLAN's virtual gateway address on a layer-3 switch) | L3 switch: every VLAN needs at least one up/access port (or trunk allowing it) | show ip interface brief |
| ARP resolves, still 100% loss | PC firewall dropping ICMP — the classic | capture on the target host |
Make it muscle memory
Build this exact topology in Packet Tracer or GNS3, then break one thing at a time and predict the symptom before you ping. When your predictions beat your test results, you have the mental model interviewers probe for: the packet is always telling you the truth; you just have to know where to look.
- Your host decides local-vs-routed first: same-subnet goes to ARP, remote goes to the gateway MAC.
- Switches add/remove 802.1Q tags; routers rewrite MAC headers but keep IP addresses.
- The common failures: missing gateway, VLAN mismatch, and an SVI with no active ports.
- A packet walk predicts exactly which capture will show the problem.