Introduction to Routers and Routing

Hello Johan

Using your topology of Sw1—Router—Sw2, where SW1 has a subnet of 192.168.1.0/24 and SW2 has a subnet of 192.168.2.0/24. Let’s say 192.168.1.1 is the default gateway, that is the Router’s IP address.

Now imagine that Host 1 with an IP address of 192.168.1.10 wants to send a packet to 192.168.2.10. It does the following:

  1. The data is received from the transport layer and encapsulated into an IP packet. The source IP is 192.168.1.10 and the destination IP is 192.168.2.10. These addresses remain the same in the header of the IP packet during the whole trip of the packet from source to destination. They do not change.
  2. The host determines that the destination is not in the same subnet, so it must send the packet to the default gateway. Now as it encapsulates the IP packet into an Ethernet frame, it uses the MAC address of Host 1 as the source MAC address and the MAC address of the default gateway as the destination MAC address.
  3. In order to get the destination MAC address, that of the gateway, it must look up the gateway IP address if 192.168.1.1 (which Host 1 knows because it is configured with a default gateway) in its own ARP table. ARP is used to determine an unknown MAC address that corresponds with the known IP address. If it has an entry for the IP address, it uses that MAC address as the destination. If it does not, it sends an ARP request (broadcast) asking for the MAC address on the network segment that corresponds with this IP address.
  4. Once the MAC address of the default router is determined, the destination MAC address field of the Ethernet frame is populated and the frame is placed on the wire to be sent.
  5. Once the frame is received by the router, it will deencapsulate it to the network layer, look at the destination IP address and reencapsulate it with the appropriate source and destination MAC addresses, that is, its own and Host 2’s respectively.

So essentially, in the Network layer, the source and destination IP addresses remain the same throughout the path of the packet. In the Data Link layer, the source and destination MAC addresses change for each hop of the path to the destination.

You can find some more information about this topic at the following lesson:

I hope this has been helpful!

Laz

2 Likes