Types of Routing
Types of Routing
Routing is a process that is performed by layer 3 (or network layer) devices in order to
deliver the packet by choosing an optimal path from one network to another.
There are 3 types of routing:
1. Static routing –
Static routing is a process in which we have to manually add routes to the routing table.
Advantages –
No routing overhead for router CPU which means a cheaper router can be used to do
routing.
It adds security because an only administrator can allow routing to particular networks
only.
No bandwidth usage between routers.
Disadvantage –
For a large network, it is a hectic task for administrators to manually add each route
for the network in the routing table on each router.
The administrator should have good knowledge of the topology. If a new
administrator comes, then he has to manually add each route so he should have very
good knowledge of the routes of the topology.
Configuration –
R1 having IP address 172.16.10.6/30 on s0/0/1, 192.168.20.1/24 on fa0/0.
R2 having IP address 172.16.10.2/30 on s0/0/0, 192.168.10.1/24 on fa0/0.
R3 having IP address 172.16.10.5/30 on s0/1, 172.16.10.1/30 on s0/0, 10.10.10.1/24 on
fa0/0.
Now configuring static routes for router R3:
R3(config)#ip route 192.168.10.0 255.255.255.0 172.16.10.2
R3(config)#ip route 192.168.20.0 255.255.255.0 172.16.10.6
Here, provided the route for 192.168.10.0 network where 192.168.10.0 is its network I’d
and 172.16.10.2 and 172.16.10.6 are the next-hop address.
Now, configuring for R2:
R2(config)#ip route 192.168.20.0 255.255.255.0 172.16.10.1
R2(config)#ip route 10.10.10.0 255.255.255.0 172.16.10.1
R2(config)#ip route 172.16.10.0 255.255.255.0 172.16.10.1
Similarly for R1:
R1(config)#ip route 192.168.10.0 255.255.255.0 172.16.10.5
R1(config)#ip route 10.10.10.0 255.255.255.0 172.16.10.5
R1(config)#ip route 172.16.10.0 255.255.255.0 172.16.10.5
2. Default Routing –
This is the method where the router is configured to send all packets towards a single
router (next hop). It doesn’t matter to which network the packet belongs, it is forwarded
out to the router which is configured for default routing. It is generally used with stub
routers. A stub router is a router that has only one route to reach all other networks.
Configuration –
Using the same topology which we have used for the static routing before.
In this topology, R1 and R2 are stub routers so we can configure default routing for both
these routers.
Configuring default routing for R1:
R1(config)#ip route 0.0.0.0 0.0.0.0 172.16.10.5
Now configuring default routing for R2:
R2(config)#ip route 0.0.0.0 0.0.0.0 172.16.10.1
3. Dynamic Routing –
Dynamic routing makes automatic adjustments of the routes according to the current state
of the route in the routing table. Dynamic routing uses protocols to discover network
destinations and the routes to reach them. RIP and OSPF are the best examples of
dynamic routing protocols. Automatic adjustments will be made to reach the network
destination if one route goes down.
A dynamic protocol has the following features:
1. The routers should have the same dynamic protocol running in order to exchange
routes.
2. When a router finds a change in the topology then the router advertises it to all other
routers.
Advantages –
Easy to configure.
More effective at selecting the best route to a destination remote network and also for
discovering remote network.
Disadvantage –
Consumes more bandwidth for communicating with other neighbors.
Less secure than static routing.
The Network Layer of the OSI Model is responsible for providing logical addressing,
which routers use to select best path for routing packets. There are two types of packets
used at this layer :
1. Data Packets –
The user data is transferred in the inter-network by these data packets. Routed
protocols are those protocols which support such data traffic. Examples of routed
protocols are IPv4, IPv6 and AppleTalk.
2. Route Update Packets –
The information about the networks connected to all the routers is updated to the
neighbouring routers through route update packets. Routing protocols are the ones
that are responsible for sending them. Examples of routing protocols are RIP(Routing
Information Protocol), EIGRP(Enhanced Interior Gateway Routing Protocol) and
OSPF(Open Shortest Path First).
Now let’s take an real-life analogy to better understand the difference between routed and
routing protocols.
Suppose you want to go to your home after your semester examinations. You book a cab
or take a bus to your home. In the path of your journey, you encounter several sign
boards which help you take proper or best path, or in case of a cab, Google Maps will
help you in choosing the best route.
In this analogy, consider yourself as the DATA, the bus or cab as the ROUTED
PROTOCOL and the sign boards or the GPS installed in your driver’s phone as the
ROUTING PROTOCOL.
Similarly, in a network routers use routing protocols to determine the best path for a
packet to travel through the inter-network more efficiently. Routed protocols are assigned
to an interface and determine the method of delivering the packet.
Now, lets move on to the different types of routing protocols.
Abbreviations –
IGP – Interior Gateway Protocol
EGP – Exterior Gateway Protocol
RIP – Routing Information Protocol
IGRP – Interior Gateway Routing Protocol
OSPF – Open Shortest Path First
ISIS – Intermediate System to Intermediate System
EIGRP – Enhanced Interior Gateway Routing Protocol
BGP – Border Gateway Protocol
Here is a topology in which there is a router and a switch and some end hosts.
2 different VLANs have been created on the switch. The router’s interface is
divided into 2 sub-interfaces (as there are 2 different VLANs) which will acts as
a default gateway to their respective VLANs. Then router will perform Inter
VLAN Routing and the VLANs will communicate with each other.
First we will assign IP address to the host PC1 as 192.168.1.10/24, Server
192.168.1.20/24, and the other host PC2 will have IP address 192.168.2.10/24
manually.
Now, we will make sub-interface of fa0/0 as fa0/0.1 and fa0/0.2 and assign IP
addresses as 192.168.1.1/24 and 192.168.2.1/24 respectively on the router’s
ports.
r1# int fa0/0.1
r1# encapsulation dot1q 2
r1# ip address 192.168.1.1 255.255.255.0
r1# int fa0/0.2
r1# encapsulation dot1q 3
r1# ip address 192.168.2.1 255.255.255.0
NOTE : Here encapsulation type dot1q is used for frame tagging between the 2
different VLAN. When the switch forwards packet of one VLAN to another, it
inserts a VLAN into the Ethernet header.
Now, we will make 2 different VLANs on switch namely VLAN 2 and VLAN 3
giving names HR_dept and sales_dept.
Switch# vlan 2
Switch# name HR_dept
Switch# vlan 3
Switch# name sales_dept
Switch# int range fa0/1-2
Switch# switchport mode access
Switch# switchport access vlan 2
Switch# int fa0/3
Switch# switchport mode access
Switch# switchport access vlan 3
Here, we have assigned VLAN 2 to the specific switch ports fa0/1, fa0/2 and
vlan 3 to fa0/3 respectively.
NOTE : int range fa0/1-2 command is used as there are more than one host
present in a single VLAN.
Now to check reachability of PC2 from PC1, we will try to PING PC2 from PC1.
From the above figures, we see that the packet is delivered to the router by the
switch, because now the broadcast domain have been divided by the different
VLANs present on the switch therefore, the packet will be delivered to the
default gateway (as PC2 is present on different network) and then to the
destination.
1. Backbone router – The area 0 is known as backbone area and the routers
in area 0 are known as backbone routers. If the routers exists partially in the
area 0then also it is a backbone router.
2. Internal router – An internal router is a router which have all of its interfaces
in a single area.
3. Area Boundary Router (ABR) – The router which connects backbone area
with another area is called Area Boundary Router. It belongs to more than
one area. The ABRs, therefore, maintain multiple link-state databases that
describe both the backbone topology and the topology of the other areas.
4. Area Summary Border Router (ASBR) – When an OSPF router is
connected to a different protocol like EIGRP or Border Gateway Protocol, or
any other routing protocol then it is known as AS. The router which connects
two different AS (in which one of the interfaces is operating OSPF) is known
as Area Summary Border Router. These routers perform redistribution.
ASBRs run both OSPF and another routing protocol, such as RIP or BGP.
ASBRs advertise the exchanged external routing information throughout
their AS.
Note – A router can be backbone router and Area Boundary Router at the same
time i.e a router can perform more than one role at a time.
Configuration –
There is a small topology in which there are 3 routers namely R1, R2, R3 are
connected. R1 is connected to networks 10.255.255.80/30 (interface fa0/1),
192.168.10.48/29 (interface fa0/0) and 10.255.255.8/30 (interface gi0/0)
Note – In the figure, IP addresses are written with their respected interfaces but
as have to advertise networks therefore, you have to write network I’d. R2 is
connected to networks 192.168.10.64/29 (interface fa0/0), 10.255.255.80/30
(interface fa0/1). R3 is connected to networks 10.255.255.8/30 (int fa0/1),
192.168.10.16/29 (int fa0/0).
Now, configuring OSPF for R1.
R1(config)#router ospf 1
R1(config-router)#network 192.168.10.48 0.0.0.7 area 1
R1(config-router)#network 10.255.255.80 0.0.0.3 area 1
R1(config-router)#network 10.255.255.8 0.0.0.3 area 1
Here, 1 is the OSPF instance or process I’d. It can be same or different (doesn’t
matter). You have use wildcard mask here and area used is 1.
Now, configuring R2
R2(config)#router ospf 1
R2(config-router)#network 192.168.10.64 0.0.0.7 area 1
R2(config-router)#network 10.255.255.80 0.0.0.3 area 1
Similarly, for R3
R3(config)#router ospf 1
R3(config-router)#network 192.168.10.16 0.0.0.7 area 1
R3(config-router)#network 10.255.255.8 0.0.0.3 area 1
You can check the configuration by typing command
R3#show ip protocols
EIGRP fundamentals
Dynamic routing Protocol performs the same function as static routing Protocol does. In
dynamic routing Protocol, if the destination is unreachable then another entry, in the
routing table, to the same destination can be used. One of the routing protocols is
EIGRP.
EIGRP:
Enhanced Interior Gateway Routing Protocol (EIGRP) is a dynamic routing protocol that
is used to find the best path between any two-layer 3 devices to deliver the packet.
EIGRP works on network layer Protocol of OSI model and uses protocol number 88. It
uses metrics to find out the best path between two layer 3 devices (router or layer 3
switches) operating EIGRP. Administrative Distance for EIGRP are:-
EIGRP routes AD values
Summary Routes5
Internal Routes 90
Click the following link to learn how to connect to the console port of the router if there
is no serial port in your computer.
Router>enable
Router#configure terminal
Router(config)#hostname Router01
Router01(config)#
Use the following IOS commands to open the fast ethernet interface Fa0/0 configuration
mode on Router01 and configure IP address as 172.16.0.1/16.
Router01>enable
Router01#configure terminal
Router01(config)#interface fa0/0
Router01(config-if)#no shutdown
Use the following IOS commands to open the serial interface S0/0 configuration mode
on Router01 and configure IP address as 172.17.0.1/16. You have to set a clock rate also
using the "clock rate" command on S0/0 interface, since this is the DCE side.
Router01>enable
Router01#configure terminal
Router01(config)#interface s0/0
Router01(config-if)#no shutdown
Router>enable
Router#configure terminal
Router(config)#hostname Router02
Router02(config)#
Use the following IOS commands to open the fast ethernet interface Fa0/0 configuration
mode on Router02 and configure IP address as 172.18.0.1/16.
Router02>enable
Router02#configure terminal
Router02(config)#interface fa0/0
Router02(config-if)#no shutdown
Use the following IOS commands to open the serial interface S0/0 configuration mode
on Router02 and configure IP address as 172.17.0.2/16.
Router02>enable
Router02#configure terminal
Router02(config)#interface s0/0
Router02(config-if)#no shutdown
Use the following IOS commands to open the serial interface S0/1 configuration mode
on Router02 and configure IP address as 172.19.0.1/16. You have to set a clock rate also
using the "clock rate" command on S0/1 interface, since this is the DCE side.
Router02>enable
Router02#configure terminal
Router02(config)#interface s0/1
Router02(config-if)#no shutdown
Router>enable
Router#configure terminal
Router(config)#hostname Router03
Router03(config)#
Use the following IOS commands to open the fast ethernet interface Fa0/0 configuration
mode on Router03 and configure IP address as 172.20.0.1/16.
Router03>enable
Router03#configure terminal
Router03(config)#interface fa0/0
Router03(config-if)#no shutdown
Use the following IOS commands to open the serial interface S0/1 configuration mode
on Router03 and configure IP address as 172.19.0.2/16.
Router03>enable
Router03#configure terminal
Router03(config)#interface s0/1
Router03(config-if)#no shutdown
In the IOS "network" command, shown below, we specify only the directly connected
networks of this router.
Router01>enable
Router01#configure terminal
Router01(config)#router eigrp 1
Router01(config-router)#network 172.16.0.0
Router01(config-router)#network 172.17.0.0
Router01(config-router)#exit
Router01(config)#exit
Router01#
In the IOS "network" command, shown below, we specify only the directly connected
networks of this router.
Router02>enable
Router02#configure terminal
Router02(config)#router eigrp 1
Router02(config-router)#network 172.17.0.0
Router02(config-router)#network 172.18.0.0
Router02(config-router)#network 172.19.0.0
Router02(config-router)#exit
Router02(config)#exit
Router02#
In the IOS "network" command, shown below, we specify only the directly connected
networks of this router.
Router03>enable
Router03#configure terminal
Router03(config)#router eigrp 1
Router03(config-router)#network 172.19.0.0
Router03(config-router)#network 172.20.0.0
Router03(config-router)#exit
Router03(config)#exit
Router03#
Router01>enable
Router01#show ip route
The "D" character at the beginning of a line in routing table shows that it is a route
discovered by Enhanced Interior Gateway Routing Protocol (EIGRP) and "C" character
shows that it is a directly connected network.
Router02>enable
Router02#show ip route
The "D" character at the beginning of a line in routing table shows that it is a route
discovered by Enhanced Interior Gateway Routing Protocol (EIGRP) and "C" character
shows that it is a directly connected network.
Router03>enable
Router03#show ip route
The "D" character at the beginning of a line in routing table shows that it is a route
discovered by Enhanced Interior Gateway Routing Protocol (EIGRP) and "C" character
shows that it is a directly connected network.
C:\>ping 172.20.0.10
The ping reply from Host03 (IP address: 172.20.0.10/16) shows that the Enhanced
Interior Gateway Routing Protocol (EIGRP) Protocol is configured well in three routers
and there is network connectivity between different networks.
Routing Information Protocol (RIP)
Difficulty Level : Easy
Last Updated : 24 Dec, 2021
Routing Information Protocol (RIP) is a dynamic routing protocol that uses hop count
as a routing metric to find the best path between the source and the destination network.
It is a distance-vector routing protocol that has an AD value of 120 and works on the
Network layer of the OSI model. RIP uses port number 520.
Hop Count
Hop count is the number of routers occurring in between the source and destination
network. The path with the lowest hop count is considered as the best route to reach a
network and therefore placed in the routing table. RIP prevents routing loops by limiting
the number of hops allowed in a path from source and destination. The maximum hop
count allowed for RIP is 15 and a hop count of 16 is considered as network unreachable.
Features of RIP
1. Updates of the network are exchanged periodically.
2. Updates (routing information) are always broadcast.
3. Full routing tables are sent in updates.
4. Routers always trust routing information received from neighbor routers. This is also
known as Routing on rumors.
RIP versions :
There are three versions of routing information protocol – RIP Version1, RIP Version2,
and RIPng.
RIP v1 RIP v2 RIPng
Doesn’t support
authentication of updated Supports authentication of
messages RIPv2 update messages –
RIP v1 RIP v2 RIPng
RIP v1 does not carry mask in RIP v2 does carry mask in updates, so it supports for
updates VLSM