Router
Reference: [Book] Network Introduction for IT Engineers
1. What is Router?
A
Routeris the representative device among various network devices operating at Layer 3, and as its name suggests, it is a device that designates routesThe
Routerchecks the destination IP address of incoming packets and uses its route (Route) information to forward packets through the optimal pathThe
Routeris an essential network device for connecting to remote networks and is a core device for network configurationA
routeris absolutely necessary for communication between different networks!
Router vs L3 Switch
Switchesare representative Layer 2 devices, butL3 Switchesthat operate at Layer 3 like routers are also widely usedPreviously, Routers were implemented in software and switches in hardware, or distinguished by feature-rich routers versus switches optimized for fast packet delivery
Recently, with technological advances, it is difficult to distinguish between
RouterandL3 switchThe content in this document is explained using routers, but everything applies equally to L3 switches!
2. How Does a Router Work?
A
Routercollects various route information, stores the optimal routes in itsrouting table,When a
packetarrives at the router, it compares the destination IP address with the routing table and sends it through the best route
Opposite to a Switch, a router drops packets whose destination address is not in the routing table
The Router removes existing Layer 2 header information during the packet forwarding process and creates new Layer 2 headers
The above router operation is called
Route designation,Broadcast control, andProtocol conversion
2-1. Route Designation
The Router's most important role is route designation
It gathers route information to build a
routing tableand forwardspacketsIP addresses are designed based on a hierarchical structure divided into
network addressandhost address, enabling distinction between local and remote networks, and allowing routes to be found based on network addressesThe Router checks these IP addresses and forwards packets to appropriate routes for remote destinations
The Router separates its role of designating routes and forwarding packets into two functions:
The role of obtaining route information, and
The role of checking obtained route information and forwarding packets
The Router only forwards packets whose routes are included in its obtained route information, so obtaining accurate destination routes is very important
How Routers Obtain Route Information
Naturally obtaining adjacent network information when entering IP addresses
Administrators directly entering route information
Routers automatically exchanging route information with each other
2-2. Broadcast Control
Switchesflood packets to all ports when the packet's destination information is unknown, for communication with devices that may exist somewhereWhile flooding to the entire LAN network under the assumption that a destination may exist somewhere might seem like it could strain overall network performance with useless packets,
LANs are small in size so the impact of flooding is small,
And since the destination network interface card (NIC) discards packets when its address doesn't match the packet's destination address, such flooding does not significantly burden the network
In contrast,
Routerswere developed with the goal of sending packets to remote locations, operating at Layer 3, and only allowing communication with clear destination informationInternet connections mostly rent specific bandwidth, so efforts are made to minimize useless communications occupying the network
If, like switches in LANs,
Packets without destinations or
With unclear destinations were flooded,
The Internet would be filled with useless packets, reaching a communication-impossible state
Routerscannot forward packets without route acquisition configuration beyond directly connected network informationThe Router's default behavior does not acquire
multicast informationand does not forwardbroadcast packetsUsing this Router function, broadcast propagation to other networks can be prevented
This function is called
Broadcast / Multicast Control
When much broadcast occurs on a network, separating networks with a router can divide the broadcast network and improve network performance
2-3. Protocol Conversion
Another role of the
Routeris connecting networks configured with different protocolsSince modern networks have converged on
Ethernet, the role of protocol conversion has diminished, but in the past, the protocols used in LAN and WAN were completely different, separate spacesLAN focused on multiple computers communicating with each other, while WAN focused on long-distance communication
LAN technology had to be converted to WAN technology for communication with remote networks like the Internet, and
Routershandled this role
The
Routeris a device operating at Layer 3, so it checks Layer 3 address information and operates based on itWhen a packet enters the Router, it strips the
Layer 2 header information, checks theLayer 3 address, then creates newLayer 2 header informationand sends it outThis is why the Layer 2 header information of a packet entering the router differs from when it leaves
Using this function, conversion between completely different technologies is possible!
3. Route Designation - Routing/Switching
When a Router processes packets, it performs two main tasks:
Obtaining route information and organizing route information
Based on organized route information, forwarding packets
Since a Router drops packets with destinations it doesn't clearly know, route information must be sufficiently collected before packets arrive for the router to operate normally
The Router must obtain complex and numerous route information to appropriately maintain the optimal route information in its
routing table
A Router can obtain diverse and numerous route information, but cases where it does not exactly match the desired destination information are more common
The Router acquires routing information in subnet units and performs
summary workto bundle multiple subnet information together for optimized routing information transmissionSo even if the packet's destination address entering the router does not exactly match the routing table information (not exact match), the closest information to the destination must be found among numerous entries to forward the packet
3-1. Routing Operation and Routing Table
In modern networks, instead of being responsible for the entire path from terminal to destination, only the route to the adjacent router needs to be specified,
The adjacent router then finds the optimal route,
And forwards the packet to the next router
This technique is called
Hop by Hop routingsince it jumps over the network one step at a time, and the adjacent router is called theNext HopThe Router does not figure out the entire path to the destination but selects and sends to the optimal
next hop
Methods for Specifying Next Hop
Next HopSpecify the next router's IP (Next hop IP address)
Specify the Router's
outbound interfaceSimultaneously specify both the Router's
outbound interfaceand next router's IP
When specifying the next hop on a Router, the common method is to specify the
Interface IP addressof the other routerOnly in special cases can the router's
outbound interfacebe specified; this can only be used when the other party's MAC address information can be discovered even without knowing thenext hop IPSpecial cases:
When using protocols like
PPP (Point-to-Point)orHDLC (High Level Datalink Control)in WAN dedicated line sections, where the other party's MAC address doesn't need to be knownWhen proxy ARP is running on the other router, allowing the other party's MAC address to be known even without the exact IP address
What is ARP?
Address Resolution Protocol
A protocol used to discover the other party's MAC address
When a Router selects which route to forward a packet, it does not consider the source
Regardless of the source, it compares the destination address with the routing table to decide which route to forward to
So when building the routing table:
Only destination information is collected,
When a packet arrives, the destination address is checked,
And the packet is forwarded to the next hop
Data Stored in the Routing Table
Destination address
Next hop IP address, local outbound interface (optional!)
The
PBR (Policy-Based Routing)feature can be used on a Router to route using the packet's source address, but this cannot be activated with the routing table that only collects destination addresses; separate configuration related to router policies is neededUsing PBR makes management difficult and problems hard to resolve, so it is only used for special purposes
Loop Free Layer 3: TTL (Time To Live)
The Layer 3 IP header has a field called
TTLThis field limits the time (Hops) a packet can live in the network!
To prevent useless packets from wandering around the Internet and wasting bandwidth, routers drop packets with unclear addresses
However, there can be cases where an operating site suddenly disappears, and while searching for alternative routes, the next hops of two facing routers may momentarily be configured as each other, causing packets to continuously bounce between the two routers
In this case, incorrect routing between the two routers creates an L3 Loop
If packets never permanently disappear, identical packets would ping-pong between devices or ghost packets that never disappear would flood the Internet
Therefore, all packets have a lifespan value called TTL, and when this value reaches 0, the packet is dropped by the network device
Here,
TTLis not actual time like seconds, but refers tohops, and the TTL value decreases by 1 with each hop
3-2. Routing (How Routers Obtain Route Information)
Routers obtain route information through 3 main methods:
Direct ConnectedStatic RoutingDynamic Routing
Route information is collected using the above 3 methods, and the optimal route for each destination is selected from the collected information to build the Routing Table
1. Direct Connected
The IP address and Subnet mask used when entering an IP address can determine the Network address information that IP belongs to
Routers and PCs automatically create the Routing Table for that Network using this information
This route information is called
Direct Connected
Since the route information created by
Direct Connectedis automatically generated when an IP is configured on an Interface,The information cannot be forcibly deleted,
And only automatically disappears when the Network configuration is deleted or the Network Interface is deactivated
2. Static Routing
When an administrator directly specifies the
destination NetworkandNext hopon the router to enter route information, it is calledStatic RoutingStatic Routingallows very intuitive configuration and management of routing information since the administrator directly specifies routes
Static Routing, likeDirect Connected, automatically deletes associated Static Routing information when the connected Network Interface information is deleted or deactivatedHowever, Logical Interfaces, unlike Physical Interfaces, may not be deactivated when the Physical Interface is deactivated, so they may not disappear from the Routing Table
3. Dynamic Routing
Static Routingis a good method for administrators to easily manage networks with few changes, but large networks are difficult to manage withStatic RoutingaloneWhy?
Route changes due to failures cannot be reflected with
Static Routing!Because
Static Routingcannot assess the status of routers beyond the current router, if a failure occurs in lines between routers or in a router itself, it cannot detect the failure and send packets through alternate routes!
Dynamic Routingcompensates for this weakness ofStatic Routingby having routers exchange their known route information or link status information to learn the entire networkSince route information is exchanged periodically or when status changes, when failures occur in lines connecting routers or in routers themselves, the situation is recognized and packets can be forwarded through alternate routes
In
Dynamic Routing, the network to advertise must be declared
Last updated