Router Functionality and Forwarding Decisions

Router Functionality and Forwarding Decisions


Router Overview

  • Definition: A router operates at the network layer, connecting multiple networks through its ports.

  • Port Connections: Each port connects to one or more networks. Complexity increases when considering multiple networks per port, but it's generally simplified by assuming a switch will handle additional network connections.


Network Addresses

  • Example Networks: Four networks represented (blue, orange, red, brown) with specific IP addresses.

  • Netmask Application: Applying a /24 netmask yields clear network addresses (e.g., Blue network: 130.216.72.0).

  • Subnetting: Understanding how netmasks define network versus host portions of an address is crucial.


Forwarding Mechanics

  • Host Decision-Making: A host checks if the destination address matches its own network address (using its netmask).

  • If it matches, it communicates within the local network; if not, it forwards to a gateway.

  • Router Operation: Instead of direct IP addresses, forwarding decisions at the router level refer to network address matched against a routing table.

    • Routing tables map network addresses to corresponding ports.


Routing Table Structure

  • Entries Example: Each entry includes the network address, netmask, and the port to which it connects.

    • Example Format:

      • Blue Network: 130.216.72.0/24 → Port 0

      • Orange Network: 130.216.64.0/20 → Port 1

      • Red Network: 203.109.205.0/24 → Port 2

      • Brown Network: 130.216.196.0/23 → Port 3


Example Scenario of IP Packet Forwarding

  • Destination Consultation: From the Orange network, if a packet's destination is 203.109.205.120, determine which port should forward this packet:

    1. Apply Netmask for each network to the destination address.

    • Each attempt identifies if the destination address falls within that network's range.

    1. Identified Match: When applying the Red Network's netmask, it yields a match, confirming Port 2 as the correct forwarding path.


Making Efficient Decisions

  • Binary and Decimal Conversions: Ability to swiftly convert IP addresses and calculate netmasks increases efficiency in exam settings.

  • Identifying Addresses by Type: Understanding whether a given address can exist under specific subnet rules (even/odd checks for bits based on netmask) is crucial.


Default Route Concept

  • Use of Default Route: In scenarios where no local network matches, traffic is forwarded to a default route (0.0.0.0), representing all unknown addresses.

  • Implementation: Typically used to send packets to the Internet through another designated router's IP address, enabling broader connectivity.


Metrics and Decision Making in Routing Tables

  • Length of Netmask Rule: Preference given to longer netmasks (more specific routes) when possible.

  • Metric Use: If the same netmask length occurs for multiple routes, additional metrics are used to determine the best route based on cost or line expenses.


ICMP and Unrouteable Packets

  • When No Route Exists: If no network matches, the packet is dropped, and an ICMP message is sent back to the originating host, indicating the packet couldn't be forwarded.

  • Analogy: Comparing router decisions to a postal system—forwarding packages based on defined paths until a final destination is realized.