11: Routing Protocols

11.1 Routing protocols basics

Image2096.JPGFigure 11.1: some routers connected to some networks.

11.1.1 What is a ‘routing protocol’?

Suppose that we have a group of routers connected to a group of networks as seen in figure (11.1), the routing protocol is used to inform every router the path to every network.

By default, every router knows about its direct connected networks – because those networks are stored in its routing table –, but it does not know about other networks.

As an example, the router ‘R1’ knows by default about networks (,, However, it does not know about other networks.

To make ‘R1’ knows about all other networks, we use the routing protocols.

11.1.2 Routing protocol types

Static routing protocol

In the static routing protocol, the administrator of the network manually configures every router.

Therefore, this method has high administrative effort on the administrator.

Dynamic routing protocol

In the dynamic routing protocol, the routers automatically communicate with each other, and exchange data about the networks it knows about. Therefore, every router knows the path to every network.

This method consumes from the router’s CPU and the network’s bandwidth.

11.1.3 Comparison between static routing & dynamic routing

5694.jpgTable 11.2: a comparison between static and dynamic routing.

11.2 Static routing

In the static routing, the administrator manually configures every router.

To make that, the administrator logs in to the router and enters to the ‘global configuration mode’.

In the ‘global configuration mode’, the administrator writes the following command,

Router(config)# ip route network IP subnet mask next hop IP


Router(config)# ip route network IP subnet mask exit interface


‘Network IP’ is the network IP of the destination network.

‘Subnet mask’ is the subnet mask of the destination network.

‘Next hop IP’ is the IP of the next hop router interface.

‘Exit interface’ is the router’s interface that the router should send the packet through it.

Suppose we have the network in figure (11.2),

Image2103.JPGFigure 11.2

The administrator needs to configure ‘R1’ to be able to reach the network ‘’.

Then, the parameter will be as following,

Network IP =

Subnet mask =

Next hop IP =

Exit interface = ser 0/0

11.3 Dynamic routing

In the dynamic routing, the routers communicate with each other in order to exchange the network’s information.

Every router should determine the shortest path (least cost path) to every network in order to store this path in its routing table to use it.

Image2111.JPGFigure 11.3

In figure (11.3), ‘R2’ is able to reach ‘Net3’ through two paths – through ‘R4’ and through ‘R3’. ‘R2’ should determine the shortest path to ‘Net3’ and store it in its routing table in order to use it.

11.3.1 Dynamic routing protocol types

The dynamic routing protocols are divided into two groups,

Distance vector routing protocols

In this type,

• Updates are sent periodically (every specific time).

• Updates contain information about the entire routing table.

• Updates are sent only to neighboring routers.

Link state routing protocols

In this type,

• Updates are sent when a change occurs in the routes.

• Updates contains information about only the affected routes.

• Updates are sent to the entire network.

11.4 Distance vector routing

In the distance vector routing, every router sends its entire routing table to only neighboring routers, and this is done every periodic time.

So, every router knows only about its neighboring routers.

The cost of the path – path metric – in the distance vector routing is determined by the ‘hop count’, which is the number of hops – routers – between the source and the destination.

Image2118.JPGFigure 11.4: the distance vector routing

By default, every router knows its direct connected networks as seen in figure (11.4).

R1 sends its routing table to R2.

R2 sends its routing table to R1 and R3.

R3 sends its routing table to R2.

After the routing table exchange between all routers, the routing table of R1, R2, and R3 respectively will be as following,

Image2127.JPGFigure 11.5: the routing tables after the route exchange

As you can see in figure (11.5), now every router is able to reach every network.

11.5 Routing loops


The routing loop is a problem that causes the packets to enter in a loop between the routers.

This problem happens because of the exchange of incorrect route information between the routers.

The routing loop may happen in a network that is using a distance vector routing protocol.

11.5.1 Routing loop solution

To solve the routing loop problem, we have many solutions,

Maximum hop count

Every packet contains a field in its IP header, which is called the ‘TTL’ (Time To Live). The TTL value is reduced every time it passes by a router.

Therefore, if a routing loop happened, the packet will be discarded after a while when the TTL value become zero.

Split horizon

It is a simple rule that says, ‘never send routing updates out of the interface this update is received from’.

Route poisoning

When a path to a network becomes unavailable, inform all the routers that, this network has infinite metric, so that all routers will update its routing table with this information.

Hold downs

This rule states that, when a route is marked as ‘unreachable’, stay in hold down state for a time that equals to the hold down time.

The ‘hold down state’ means, do not accept updates about this route.