Packet Path/

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.

Troubleshooting · Beginner · 10 min · September 30, 2026

Illustration of a data packet traveling through a switch, router, and server
In plain EnglishA VLAN (virtual LAN) splits one physical switch into separate virtual networks that can't talk without a router. When you ping a computer on another VLAN, your PC first does subnet math to realize the target is remote, asks "who is my gateway?" (ARP), and the packet then rides across tagged trunk links to the router — which strips the tag, picks the right VLAN, re-tags, and delivers it. This article walks that packet hop by hop, and shows where each hop breaks.

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

Packet walk: ping across VLANs, animated PC1 192.168.10.50 · VLAN 10 Switch 1 access + trunk Router .10.1 on VLAN 10 .20.1 on VLAN 20 Switch 2 trunk + access PC2 192.168.20.50 · VLAN 20 802.1Q trunk 802.1Q trunk access access 1 · addressed to the gateway's MAC 2 · tagged VLAN 10 3 · router: untag, route, re-tag VLAN 20 4 · tagged VLAN 20 5 · untagged to PC2 802.1Q: VLAN 10 ICMP echo 802.1Q: VLAN 20 802.1Q: VLAN 10 echo reply The echo reply reverses the whole path: tag VLAN 20 on the right trunk, tag VLAN 10 on the left trunk. Full cycle repeats every 24 seconds. Amber badge = the 802.1Q sticker the switch adds on trunks.
The life of one ping: PC1 sends the echo request to its gateway's MAC, Switch 1 tags it for VLAN 10, the router pops the tag, routes the IP packet, re-tags it for VLAN 20, and Switch 2 delivers it untagged to PC2. The reply mirrors the journey. Notice the IP addresses never change — only the Ethernet pouch and the VLAN sticker do.

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:

ARP: "who has 192.168.10.1?" — animated PC1 needs the GW MAC SW1 Router 192.168.10.1 ARP broadcast: "who has 192.168.10.1?" → ff:ff:ff:ff:ff:ff is at 00:1B:2C:3D:4E:5F PC1's ARP table: 192.168.10.1 → 00:1B:2C:3D:4E:5F Broadcast reaches everyone on VLAN 10 — only the router answers, unicast.
ARP in action: PC1 shouts to the whole VLAN ("who has 192.168.10.1?"). The router answers directly with its MAC, and PC1 files it in its ARP table.

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.

Core invariantRouters rewrite the L2 header (MACs — the courier pouch) at every hop but preserve the L3 packet (IPs — your letter) end to end — except TTL (time to live — a countdown decremented by each router so lost packets eventually die instead of looping forever), which decreases by one per routing hop.

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:

Packet 1 — ARP request 60 bytes on the wire (28 shown + Ethernet header)  who has 192.168.10.1? tell 192.168.10.50
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.

Packet 2 — ICMP echo request 192.168.10.50 → 192.168.20.50  Echo (ping) request, id=1, seq=7
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.

Reference topology for this article PC1 192.168.10.50/24 VLAN 10 · GW .10.1 SW1 L2 switch Router g0/0.10 · 192.168.10.1 g0/0.20 · 192.168.20.1 SW2 L2 switch PC2 192.168.20.50/24 VLAN 20 · GW .20.1 access 10 trunk trunk access 20 Single lines = access ports (one VLAN, untagged). Double lines = trunks (many VLANs, 802.1Q tagged). The router's subinterfaces g0/0.10 and g0/0.20 are the two gateways — "router on a stick."
Keep this picture in your head while troubleshooting: every symptom in the table below is one of these links, tags, or gateway addresses being wrong.

Where this breaks (the real reason to learn it)

SymptomSuspectOne command
"Destination host unreachable" instantlyNo route / no gateway configuredip route / route print
Ping fails, gateway ARP incompleteVLAN 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 failsNo IP routing on L3 switch; subinterface downshow 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% lossPC firewall dropping ICMP — the classiccapture 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.

Try it yourselfCheck your subnet math before you troubleshoot: the subnet calculator runs the AND operation from Step 1 for any address and mask, so you can confirm "local or remote?" in seconds.
Key takeaways
  • 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.