Network Layers: Link, Network, and Routing Protocols
Network Model Layers
The network model is structured into several layers:
- Application Layer: Handles data exchange between applications (app2app) using protocols like HTTP.
- Transport Layer: Manages process-to-process communication using TCP/UDP, handling packets.
- Network Layer: Responsible for non-directional host-to-host packet delivery, using IP.
- Link Layer: Facilitates direct host-to-host communication over a link, using technologies like Ethernet.
- Physical Layer: Deals with the physical transmission of signals.
A typical data packet includes: [LL header, Network header, Transport header, Application data, LL trailer]. Ethernet frames are structured as: [preamble, destination address, source address, type, data, CRC].
Link Layer
The Link Layer transfers datagrams from one node to another over a link. Its services include:
- Framing
- Flow control
- Error detection and correction
- Half/full duplex communication.
The Link Layer is implemented in a Network Interface Card (NIC). Multiple Access Protocols determine how nodes share a channel and handle collisions. There are three main types:
- Channel Partitioning: Allocates the channel (e.g., Time/Frequency Division Multiple Access).
- Random Access: Not divided, allows collisions (e.g., Slotted ALOHA, CSMA/CD). Slotted ALOHA, with a probability ‘p’, is about 37% effective.
- “Taking Turns”: Polling, token passing.
Channel partitioning is efficient for high loads, random access for low loads, and “taking turns” combines the best of both. Ethernet uses unslotted CSMA/CD with NIC and exponential backoff.
Switches are Link Layer devices that use CSMA/CD to forward frames. They utilize a switch table with flooding and are smart, plug-and-play devices. The Address Resolution Protocol (ARP) is used to find the MAC address when the IP address is known. For example, sending a packet from A to B via router R:
- A sends a packet with A’s source IP, B’s destination IP, and R’s destination MAC.
- R repacks the packet with R’s source MAC and B’s destination MAC.
- R sends the packet to B.
Network Layer
The Network Layer has two key functions: forwarding and routing. The internet uses a “best effort” model. A switching fabric transfers packets from input to output buffers. Buffering occurs when packets arrive too quickly, and a scheduling discipline selects among queued packets. The Internet Control Message Protocol (ICMP) is used by hosts and routers to communicate, including error reporting. IPv4 uses 32-bit addresses, while IPv6 uses 128-bit addresses.
An interface is the connection between a host/router and the physical link. A subnet is an isolated network created by detaching interfaces from the host. IP addresses can be assigned by hardcoding or dynamically using the Dynamic Host Configuration Protocol (DHCP). DHCP allows hosts to obtain an IP address dynamically from a server when joining the network, enabling address reuse.
Three methods address IP address exhaustion:
- Classless Inter-Domain Routing (CIDR): The network portion of the address is defined as a.b.c.d/x.
- IPv6 with tunneling.
- Network Address Translation (NAT): All data leaving the local network uses a single NAT IP address.
The NAT Traversal Problem occurs when a client wants to connect to a host but only knows the NAT IP. Three solutions are:
- Statically configure port forwarding.
- Use Universal Plug and Play (UPnP) with the Internet Gateway Device (IGD) Protocol to automate port forwarding.
- Relaying (e.g., Skype).
Carrier-Grade NAT (CGN) refers to large-scale NAT networks.
Routing algorithms can be:
- Global: Knowing all link costs (Link State algorithm).
- Decentralized: Knowing only neighbors’ costs (Distance Vector algorithm).
Hierarchical routing combines routers into regions called Autonomous Systems (AS). Intra-AS routing occurs within the same AS, while Inter-AS routing reaches routers outside the AS. Intra-AS routing is also called Interior Gateway Protocols (IGP). Inter-AS routing is managed by the Border Gateway Protocol (BGP), which is considered the “glue of the internet.” BGP has two parts:
- eBGP: Obtains subnet reachability information from other ASes.
- iBGP: Propagates the information to all routers within the AS.
BGP routes are selected based on preference, shortest AS-PATH, and closest NEXT-HOP (hot potato routing). Transmission classes include:
- Broadcast: The same message is sent to everyone.
- Unicast: A message is sent to one person.
- Multicast: The same message is sent to multiple recipients, but not everyone.
- Anycast: Used for replication services (e.g., root DNS servers).
Reasons for network monitoring include troubleshooting, real-time system tuning, provisioning, understanding network behavior, intrusion prevention, and theft prevention. Monitoring can be done through routers, shared networks, switched networks, and wiretaps.