13  Routing table

  • Routers record all IP networks that they are aware of within an IP routing table. This is an important difference between switches and routers. A switch needs to learn which ports individual devices are connected to within the local network, whereas a router is only concerned with locating the IP networks connected to its interfaces.
Figure 27
  • The entries in a routing table provide information about how a router learnt about each network, and which interface it should forward packets to that are destined for a particular network. In the diagram above, R1 learnt that network exists because it was configured with an IP address ( which falls within that network. Because this address was configured on G0/1, R1 will forward packets destined for network towards that interface.
  • You can see that the same is true for network, which is connected to R1 G0/0 interface. R1 thus considers these networks to be directly connected and it states this explicitly within each routing table entry.
  • Packet forwarding by a router is similar to how an Ethernet switch forwards frames, but unlike in frame forwarding the router does not need to learn the IP addresses of individual devices.

Packet forwarding by a router

Figure 28
  • Note that because the router is using Gigabit Ethernet interfaces, they are assigned MAC addresses. These are shown below the IP addresses of each interface and have been simplified for clarity. The IP, MAC and default gateway of PC1a and PC3 are also shown.
Figure 29
  • In the diagram above, PC1a creates a packet destined for PC2. It uses its own IP ( as the source, and PC2’s IP ( as the destination. PC1 recognises that PC2 is on a different IP network, so it encapsulates the packet in a frame with the destination MAC address of its default gateway, R1 G0/1 (00:00:00:11:11:11).
  • The packet is forwarded across the local network by S1 to R1 G0/1. R1 de-encapsulates the frame, and examines the packet’s destination IP address and compares it with the entries in its routing table. R1 has an entry for the IP network which PC2 is within, which allows it to identify the exit interface for the network as G0/0.
  • R1 switches the packet to interface G0/0, which encapsulates it within a frame using PC2’s MAC address as its destination:
  • The frame is forwarded to S2, which will deliver it to PC2 based on the destination MAC address it finds in the frame.

Activity: Source MAC address

In the previous example, the source address used in the frame identified R1 G0/0 as the source of the frame. Can you work out which source MAC address will be used when PC3 replies to PC1a?

To use this interactive functionality a free OU account is required. Sign in or register.
Interactive feature not available in single page view (see it in standard view).


PC3 will need to direct the frame to its default gateway using the MAC address of R1 G0/0 – 00:00:00:00:00:00.

  • The example above illustrates the following points:
    • The source and destination IP addresses are not changed when a packet is forwarded.
    • A packet is encapsulated in two different frames during its transmission.
    • The MAC addresses used within frames are all different.
  • These points show that IP provides end-to-end delivery of packets across multiple IP networks using globally unique addresses. The source and destination addresses within a packet must remain the same to allow end devices to be identified.
  • Ethernet frames are used for the delivery of data across local networks, using locally significant MAC addresses.
  • There is one final difference in the way that routers and switches behave when they forward packets and frames (respectively).
    • You saw previously that when a switch receives a frame which has a destination MAC address that is not currently in the MAC address table, the switch will flood the frame out of all ports, apart from the port that received the frame. Put simply, a switch cannot drop frames.
    • However, a router will only forward a packet if it can find an entry in the routing table matching the destination IP address. If there is no matching entry, then the packet will be dropped.

12  Router operation

14  Network address translation