Router Basics
A Router is one of the core devices in networking, performing a critically important role at the Network Layer (Layer 3) of the previously discussed OSI 7-Layer Model.
1. Core Principle of the Router: Routing
The router communicates using IP addresses (Layer 3 addresses) and operates as follows:
① IP Address-Based Operation
A router reads the destination IP address in the packet's IP header to determine which network the address belongs to.
② Routing Table
The router maintains Routing Tables internally, which store path information. This table contains the next hop information required to reach a destination network. * Role: The router compares the destination IP address of the received packet with its routing table to decide which port the packet should be forwarded through to reach the destination via the optimal path.
③ Protocol Utilization
Routers use Routing Protocols (e.g., OSPF, BGP) to exchange path information with other routers and update the routing table in real-time based on network changes.
2. Relationship with the OSI 7-Layer Model and Key Functions
| Category | Description |
|---|---|
| Operating Layer | Operates at the Network Layer (Layer 3) |
| Address Handling | Determines the packet's path and forwards it based on the IP address |
| Key Functions | 1. Network Interconnection: Connects network segments with different IP address ranges (connecting heterogeneous networks). |
| 2. Optimal Path Determination: Selects the most efficient path to the destination based on the routing table. | |
| 3. Broadcast Control: Prevents broadcast packets from crossing into other networks, thus reducing network load. |
3. Router vs. Switch Comparison (FAQ)
A router connects different networks, while a switch connects devices within the same network.
| Feature | Router | Switch |
|---|---|---|
| Operating Layer | Layer 3 (Network Layer) | Layer 2 (Data Link Layer) |
| Address Used | IP Address (Logical Address) | MAC Address (Physical Address) |
| Function | Routing and network interconnection | Switching and port connection |
| Connection Scope | Connects different networks (WAN, Internet) | Connects devices within the same network (LAN) |