📡Systems Approach to Computer Networks Unit 10 – Network Layer: Forwarding & Routing

The network layer is the backbone of data transmission across networks. It handles the crucial tasks of forwarding packets between routers and determining optimal paths from source to destination. This layer employs IP addressing, subnetting, and routing protocols to ensure efficient packet delivery. Key concepts include forwarding tables, longest prefix matching, and routing algorithms like link-state and distance-vector. Understanding these fundamentals is essential for grasping how data travels through complex networks and how routers make decisions to guide packets to their destinations.

Key Concepts

  • Network layer responsible for delivering packets from source to destination across multiple links and through intermediate routers
  • Forwarding moves packets from router's input to appropriate output port based on routing table
  • Routing determines path taken by packets from source to destination using routing algorithms
  • IP addressing assigns unique identifiers to devices on a network enabling packet delivery
  • Subnetting divides IP address space into smaller subnetworks for efficient address allocation and network management
    • Subnet mask determines network and host portions of an IP address
    • Classless Inter-Domain Routing (CIDR) notation represents IP address and subnet mask (192.168.1.0/24)
  • Routing protocols (OSPF, BGP) exchange information between routers to populate routing tables and determine optimal paths

Network Layer Functions

  • Addressing assigns unique identifiers to devices for packet delivery and network configuration
  • Encapsulation adds network layer header containing source and destination IP addresses to enable end-to-end delivery
  • Fragmentation and reassembly divides packets into smaller fragments when necessary to accommodate link MTU and reassembles at the destination
  • Routing determines optimal path for packets from source to destination based on network topology and routing algorithms
  • Forwarding moves packets between input and output ports of routers along the determined path
    • Routing table lookup matches destination IP address to appropriate output interface
  • Error handling detects and attempts to recover from network layer errors (TTL expiration, checksum mismatch)
  • Quality of Service (QoS) prioritizes and manages network traffic to meet performance requirements of different applications

Forwarding Basics

  • Forwarding table maps destination IP addresses to output interfaces for packet forwarding
  • Longest prefix match determines most specific entry in forwarding table that matches packet's destination IP
    • Example: Packet destined for 192.168.1.100 matches entry for 192.168.1.0/24 rather than 192.168.0.0/16
  • Forwarding decision made independently for each packet based on current state of forwarding table
  • Forwarding tables populated by routing protocols or manually configured by network administrators
  • Hardware-based forwarding uses specialized ASICs for high-speed packet processing and forwarding
  • Software-based forwarding implements forwarding logic in router's operating system for flexibility and control
    • Slower than hardware-based forwarding but allows for easier modification and customization

Routing Algorithms

  • Link-state algorithms (OSPF) flood network topology information to all routers, allowing each router to independently compute shortest paths
    • Dijkstra's algorithm used to calculate shortest paths based on link costs
    • Converges quickly but requires more memory and processing power
  • Distance-vector algorithms (RIP) exchange routing information only with directly connected neighbors
    • Bellman-Ford algorithm used to iteratively update and propagate routing information
    • Slower convergence and prone to routing loops but simpler and less resource-intensive
  • Path-vector algorithms (BGP) include full path information with each routing update to prevent loops and allow for policy-based routing
  • Hierarchical routing divides network into smaller, more manageable areas or levels to improve scalability and reduce routing table size
    • OSPF uses two-level hierarchy with backbone area (Area 0) and regular areas
  • Load balancing distributes traffic across multiple paths of equal cost to improve network performance and reliability

IP Addressing and Subnetting

  • IP addresses uniquely identify devices on a network and consist of network and host portions
    • IPv4 addresses are 32 bits long, represented in dotted-decimal notation (192.168.1.1)
    • IPv6 addresses are 128 bits long, represented in hexadecimal notation (2001:0db8:85a3:0000:0000:8a2e:0370:7334)
  • Subnetting divides IP address space into smaller subnetworks for efficient address allocation and network management
    • Subnet mask determines the network and host portions of an IP address
    • Classless Inter-Domain Routing (CIDR) notation represents IP address and subnet mask (192.168.1.0/24)
  • Private IP addresses (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) are not globally unique and can be used within an organization
  • Public IP addresses are globally unique and assigned by regional internet registries (ARIN, RIPE, APNIC)
  • Network Address Translation (NAT) allows multiple devices with private IP addresses to share a single public IP address
    • Enables conservation of public IP address space and provides a level of security by hiding internal network structure

Routing Protocols

  • Interior Gateway Protocols (IGPs) operate within a single autonomous system (AS) to exchange routing information between routers
    • Open Shortest Path First (OSPF) is a link-state IGP that floods topology information and uses Dijkstra's algorithm for shortest path calculation
    • Routing Information Protocol (RIP) is a distance-vector IGP that exchanges routing updates with directly connected neighbors
  • Exterior Gateway Protocols (EGPs) operate between autonomous systems to exchange routing information and enable inter-domain routing
    • Border Gateway Protocol (BGP) is the de facto standard EGP used for routing between ASes on the Internet
    • BGP uses path-vector algorithm and supports policy-based routing for traffic engineering and business relationships
  • Routing protocol configuration includes enabling the protocol on router interfaces, setting router IDs, and defining area or AS boundaries
  • Routing protocol authentication ensures the integrity and origin of routing updates to prevent unauthorized changes or attacks
    • MD5 or SHA-based authentication methods commonly used
  • Redistribution allows for the exchange of routing information between different routing protocols or instances to enable end-to-end connectivity

Network Layer Protocols

  • Internet Protocol (IP) is the primary network layer protocol for the Internet, responsible for addressing, encapsulation, and fragmentation
    • IPv4 is the most widely used version, with a 32-bit address space
    • IPv6 is the next-generation protocol, with a 128-bit address space and improved security and quality of service features
  • Internet Control Message Protocol (ICMP) is used for error reporting and diagnostic purposes in IP networks
    • ICMP messages include destination unreachable, time exceeded, and echo request/reply (used by ping utility)
  • Internet Group Management Protocol (IGMP) is used for managing multicast group membership in IP networks
    • Allows hosts to join or leave multicast groups and routers to track group membership for efficient multicast forwarding
  • Address Resolution Protocol (ARP) maps IP addresses to MAC addresses for communication within a broadcast domain
    • ARP cache stores recently resolved IP-to-MAC mappings for improved performance
  • Reverse Address Resolution Protocol (RARP) maps MAC addresses to IP addresses, used by diskless workstations to obtain an IP address during boot

Real-World Applications

  • Content Delivery Networks (CDNs) use anycast routing to direct users to the nearest content server for improved performance and scalability
    • Anycast assigns the same IP address to multiple servers, allowing BGP to route users to the closest server based on network topology
  • Software-Defined Networking (SDN) separates the control plane and data plane, enabling centralized, programmable network control
    • OpenFlow protocol used for communication between SDN controllers and network devices
    • Enables fine-grained traffic engineering, network virtualization, and rapid deployment of new services
  • Virtual Private Networks (VPNs) use network layer tunneling protocols (IPsec, GRE) to create secure, encrypted connections over public networks
    • Allows remote users to securely access corporate resources and enables site-to-site connectivity between branch offices
  • Internet of Things (IoT) devices often use 6LoWPAN, an adaptation of IPv6 for low-power wireless networks
    • Enables IP-based communication and interoperability among resource-constrained IoT devices
    • Supports header compression and fragmentation to reduce overhead and accommodate small packet sizes
  • Network address translation (NAT) and port forwarding enable communication between private networks and the public Internet
    • NAT translates between private and public IP addresses, allowing multiple devices to share a single public IP
    • Port forwarding maps specific ports on the public IP to devices on the private network, enabling inbound connectivity to servers or services


© 2024 Fiveable Inc. All rights reserved.
AP® and SAT® are trademarks registered by the College Board, which is not affiliated with, and does not endorse this website.

© 2024 Fiveable Inc. All rights reserved.
AP® and SAT® are trademarks registered by the College Board, which is not affiliated with, and does not endorse this website.