Routers do most of their work at the Network Layer (Layer 3) of the OSI model. While routers can function in one interface (one-armed router), they generally have at least two network interfaces, but can have many more physical and/or logical interfaces.

Routing Tables

You would tend to think that routers are very complex network devices, but in reality, network routers route based on some simple rules that are loaded in memory. These rules are dependent on their local routing tables. Routing begins as packets come into the router. The router strips the Layer 2 information from the frames it receives. If the router is configured to route based on destination IP information (which is the most common form of routing), the router inspects each packet’s destination IP address and then sends the packet out to the correct port. The router uses the routing table to make this decision. Essentially, that is the complete process in a nutshell. The routing table is the key to the process of forwarding packets to their proper destination. Each row in the routing table defines a single route. Each column identifies specific criteria so the router can match the best route for the packet it is trying to forward.

Network Destination: All network interfaces, local subnets, and remote subnets that the router knows about will be listed.Netmask: Subnet masks are used in conjunction with IP information to determine the network ID and host ID within an IP address. The router uses this information to determine if there is a match between the packet it is inspecting and any item listed in the routing table. If there is a match, the Interface column in the routing table tell the router which interface to send the packet.Default route: The first entry showing the network destination of 0.0.0.0 is considered the router’s default route. If no other entries in the routing table can be matched, the router sends the packet to its default gateway. The default route is very important because this tells the router exactly what to do with every incoming packet unless the router can make a match with another entry in the routing table.

Routers are not the only devices that use routing tables. All TCP/IP hosts on the network have routing tables. Computers with one NIC have very simple routing tables. They have a few entries about the subnet they are connected to and an entry for the default route. However, some computers may have more than one network connection. Therefore, just like routers, computers use the same process to determine which network port to use to send out IP packets. For devices that have more than one network adapter, they are known as multi-homed systems. You may have also noticed that the routing table has a metric column. The metric is a relative value that defines the cost of using this route. If a TCP/IP has more than one route available to reach the destination node, it will use the route with the lowest metric. If the TCP/IP node determines that one of its routes is unavailable, it will either adjust the metric or remove the route from its table.

Static and Dynamic Routing

Routing tables are populated using two methods. Either the information is manually entered (static) or they can learn (dynamic) about routes from other sources such as neighboring routers. While static routing works perfectly fine, on large networks, it may be difficult to maintain these tables especially if the network layout routinely changes. In a full mesh topology, links can go down, network devices change, and other factors can add to the increased management of a network router. With dynamic routing, you allow the routers to manage their own routing tables.

Internet Routing

Routers on the public Internet do not share routing information with routing protocols such as RIP or OSPF. They use the concept called Autonomous System (AS). Autonomous Systems use a globally unique Autonomous System Number (ASN) assigned by the IANA. Just as you would assign an IP address to a router’s interface, you would configure the router to use the ASN assigned by the IANA. Autonomous Systems communicate with each other using an Exterior Gateway Protocol (EGP). The networks within an AS communicate with protocols known as an Interior Gateway Protocol (IGP). For the public Internet, the community has settled on one protocol for communication between each AS, known as the Border Gateway Protocol (BGP).

Distance Vector Routing

Distance vector routing protocols were the first to appear in the TCP/IP routing world. Distance vector routing protocols are generally used on LAN routers. The foundation of all distance vector routing protocols is some form of cost. The cost of a route is made up of the hop count, which is the number of interfaces between the source and target network. If you had a router one hop away from a network, the cost for that route would be 1. RIP, or routing information protocol, is an example of a distance vector routing protocol. While distance vector routing protocols are easy to implement and manage, they do have their limitations. For example, you may have multiple pathways to a target network. The path with two hops may be configured with very fast links while the path with one hop is a very slow link. Because of this, metrics are assigned to the routes so they can be calculated as a part of the total cost of the route. The faster links are assigned lower metrics than slower links to ensure that the router chooses the fastest path to the destination network. Distance vector routing protocols calculate the total cost to get to a particular network and compares that cost to the total cost of all the other routes to get to the same network. The router then chooses the route with the lowest cost. Routers using a distance vector routing protocol exchange their routing tables with each other.

Because of some of the limitations in distance vector routing, such as speed and bandwidth newer more optimal routing protocols were developed. The link state dynamic routing protocol is a better option for networks that have a large number of routers that exchange their routing tables dynamically. Link state routing only sends out routing information as the network changes, and only sends out the changes, rather than sending out the entire routing table at specified intervals. Open Shortest Path First (OSPF) is the most commonly used IGP. OSPF converges dramatically faster and is much more efficient than RIP. Unlike RIP, OSPF is a complex protocol for routers.

What is a Network Router  - 94