Before we understand what is routing and how it works, we need to know about router. Router is a network hardware device that is used to connect two different networks. It works on layer 3 (network layer). The primary function of a router is- to forward the packets from one network to another by choosing a best path. Routers manage routing table that contains a list of best path.
Not to forget that next generation firewalls and L3 switches also supports routing capabilities.
Now, routing is the process of selecting a best path. In a network, there are many routes in between source and destination. But we want a best path, where traffic congestion is less and packets are delivered fast.
Let’s see below router’s internal network layer routing for each packet from beginning to arriving in a router interface:
Types of Routing:
We have mainly three types of routing: Static, Default and Dynamic. Let’s see below image for more in each type:
Static Routing: In static routing, commands are manually configured by network administrator. The routes, which configured by using static routing are permanent routes. These routes will not changed until changed by manual configuration.
To configure static routing, we require network ID, subnet mask and next-hop address. Static routes are fast and secure. AD value of static route is 1.
Configuring Static Route: There are two ways to configure static routing.
- Router(config)# ip route <Destination Network ID> <Destination Subnet Mask> <Next-hop IP address >
- Router(config)# ip route <Destination Network ID> <Destination Subnet Mask> <Exit interface type><interface number>
Default Routing: Default routing is configured only when destination is unknown. It is also configured manually. Default routing path is least preferred path. When there is no entry for the destination network in a routing table, the router will forward the packet to its default route.
Configuring Default Route
- Router(config)# ip route <Destination Network ID> <Destination Subnet Mask> <Next-hop IP address >
- Router(config)# ip route <Destination Network ID> <Destination Subnet Mask> <Exit interface type><interface number>
Dynamic Routing: In dynamic routing, we configure a dynamic routing protocol that learns routes automatically and also when changes are happened in network updates the routing table accordingly. For example for internal gateway routing (IGP), we use OSPF, EIGRP and IS-IS and for external gateway protocol (EGP) BGP is used.
Advantages of Dynamic over static routing :
- There is no need to know the destination networks.
- Need to advertise the directly connected networks.
- Updates the topology changes dynamically.
- Administrative work is reduced
- Used for large organizations.
- Neighbor routers exchange routing information and build the routing table automatically.
Dynamic Routing Protocols: divided into two categories-
- IGP (Interior Gateway Protocol): IGP are used within an autonomous system. RIP, IGRP, EIGRP, OSPF, IS-IS come under IGP protocols.
- EGP (Exterior Gateway Protocol): EGP are used between different autonomous system. BGP is the only protocol that lies under EGP.
What is AD value?
AD stands for administrative distance. When router learns two different paths for same destination by using different protocols. In that situation to decide which is best path, router first checks AD value. The path that has lower AD value, is considered as best path. AD values are predefined.
Here are the default AD values for different routing protocols-
Routing Protocol | Administrative Value (AD) |
Connected route | 0 |
Static route | 1 |
RIP | 120 |
IS-IS | 115 |
OSPF | 110 |
EIGRP | 90 |
External EIGRP | 170 |
BGP | 20 |
Internal BGP | 200 |
Unknown | 255 |