Skip to content

W2·A4 — Two legs in two networks

Time: 20 min

Needs: one OL9 PC node, 2 VPCS

GNS3 project: w02-a4-router

Info

Times listed are approximate and provided as timing guidelines only. Take as much time as you need to complete the activity.

Question

How do hosts in separate networks scattered across the globe manage to talk to each other while knowing little about each other's location


Predict first

  • What does a node need to know before it can send a packet to another network? ______
  • What is the minimum number of networks a router belongs to? ______

Build it

  • Drag one OL9 PC node on to the canvas, name it RTR. Right-click it, then Configure -> Network -> Adapters, set the number of adapters to 2
  • Drag two VPCS nodes on to the canvas, cable them each to one of RTR interfaces
  • Start everything

Log on to RTR as root, then:

nmcli con mod 'System eth0' con-name eth0 \
ipv4.method manual ipv4.addresses 192.168.10.1/24

nmcli con mod 'Wired connection 1' con-name eth1 \
ipv4.method manual ipv4.addresses 203.0.113.1/24

nmcli con up eth0
nmcli con up eth1

sysctl -w net.ipv4.ip_forward=1

What just happened

  • RTR needed two interfaces to connect to two separate links. It's like a dual-citizen with two passports
  • sysctl -w net.ipv4.ip_forward=1 enabled IP Forwarding. This allows a node to receive a packet on one interface and send it out of another interface. This is what makes RTR a router.

Do this - test it

On PC1:

ip 192.168.10.11/24 192.168.10.1
save

On PC2:

ip 203.0.113.12/24 203.0.113.1
save

Right-click on PC1 cable -> start capture

Do the same on PC2 cable

On PC1:

ping 203.0.113.12 -c 1

In the PC1 capture, select the ICMP packet:

  • Look at the destination IP address. Whose address is that?
  • Look at the destination MAC address. Whose address is that?

In the PC2 capture, select the ICMP packet:

  • Look at the source IP address. Whose address is that?
  • Look at the source MAC address. Whose address is that?

What just happened

  • ip 192.168.10.11/24 192.168.10.1 assigns an address and gateway to PC1. The gateway is where PC1 sends packets addressed outside its network
  • Note that the gateway is one of RTR's addresses. The router receives the packet, consults its routing table to figure out where to send the packet next.
  • Both source and destination IPs are the same in the two captures
  • MAC addresses, on the other hand, cannot cross network boundaries. When RTR receives the packet from PC1, it discards the frame, creates a new frame with itself as the source and sends it out to PC2. This is how routing works, the principle the entire internet is built on.

Record

Whose address? (answer with PC1, PC2 or RTR)

PC1 capture PC2 capture
ICMP source IP address
ICMP source MAC address
ICMP destination IP address
ICMP destination MAC adress

One sentence: does RTR IP addresses appear in any of the two captures at all? If so, for what purpose?



If it went wrong

Symptom Cause Fix
ping times out IP forwarding not enabled sysctl -w net.ipv4.ip_forward=1 on RTR
ping fails with Destination unreachable Wrong subnet or PCs have no gateway show ip on destination