routers - dwilson2547/wiki_demo GitHub Wiki

Network Routing: Routers vs. Switches


1. What is Network Routing?

  • Routing is the process of forwarding data packets between different networks (e.g., your local network and the internet).
  • Routers are Layer 3 (Network Layer) devices that use IP addresses to determine the best path for data to travel from source to destination.

2. How Routers Work

  • Packet Inspection: Routers examine the destination IP address of each packet.
  • Path Determination: Using a routing table, the router decides the optimal path for the packet.
  • NAT (Network Address Translation): Routers often translate between private IP addresses (e.g., 192.168.1.1) and public IP addresses (e.g., 203.0.113.45).
  • Connecting Networks: Routers link multiple networks, such as your home network and the internet.

3. Key Functions of a Router

  • Inter-network Communication: Routes data between different networks (e.g., LAN to WAN).
  • Traffic Management: Uses protocols like OSPF, BGP, or RIP to find the best path.
  • Security: Often includes firewall features to filter traffic.
  • DHCP: Assigns IP addresses to devices on the local network.

4. How Switches Differ from Routers

Feature Router Switch
Layer Operates at Layer 3 (Network) Operates at Layer 2 (Data Link)
Purpose Connects different networks (e.g., LAN to WAN) Connects devices within the same network
Addressing Uses IP addresses Uses MAC addresses
Forwarding Forwards packets based on IP routes Forwards frames based on MAC addresses
Broadcast Domain Separates broadcast domains All ports share one broadcast domain (unless using VLANs)
NAT Supports NAT for private/public IP translation No NAT functionality
Example Use Connects your home network to the internet Connects your computer, printer, and TV at home

5. Why Both Are Needed

  • Switches efficiently handle local traffic within a single network.
  • Routers enable communication between networks, such as accessing the internet or connecting to a remote office.

6. Practical Example

  • Switch: If your laptop sends a file to your printer, the switch forwards the data directly to the printer within your home network.
  • Router: If your laptop requests a webpage, the router forwards the request to the internet and returns the response to your laptop.

7. Modern Routers

  • Wireless Routers: Combine routing with Wi-Fi access.
  • Enterprise Routers: Handle complex networks with advanced features like VPN, QoS, and multiple WAN links.

⚠️ **GitHub.com Fallback** ⚠️