Routing between two subnets

Follow a packet through a router.

Network

Scroll sideways to exploreOpen full diagram
PC1 connects through SW1 to R1 eth0; R1 eth1 connects through SW2 to PC2.
Addresses, gateways, and IPv4 forwarding are configured.
Open a console

1. Inspect routes

PC1

ip -j address show
ip -j route show

R1

ip -j route show
sysctl -n net.ipv4.ip_forward

Find the route to PC2. IPv4 forwarding should be enabled: 1.

2. Follow the packet

R1

timeout 120 tcpdump -U --immediate-mode -i eth1 -w /tmp/lab-router.pcap "arp or icmp" &
capture_pid=$!
sleep 1

PC1

ping -n -c 3 -W 1 10.0.0.1
ping -n -c 3 -W 1 10.0.1.2

PC2

ping -n -c 3 -W 1 10.0.0.2

R1

sleep 2
kill -INT "$capture_pid"
wait "$capture_pid" || true
tcpdump -nn -e -r /tmp/lab-router.pcap

The pings should succeed. The capture keeps PC1 as the IP source, while R1 is the Ethernet source. Forwarding reduces TTL by one.

Validation

Click "Check". Once all steps pass, click "End".