Copyright © Huawei Technologies Co., Ltd. All rights reserved.
Page 0
Copyright © Huawei Technologies Co., Ltd. All rights reserved. Page 1
Copyright © Huawei Technologies Co., Ltd. All rights reserved. Page 2
A router provides mechanisms for interconnecting networks of different structures
which makes the transfer of packets among networks a reality. Routes are
information about the path that guides the forwarding of packets. In the internet,
routes are decided by routers. A router chooses an appropriate route according to
the destination address in the header of the packet and sends the packet to the
next router. The last router on the route is responsible for delivering the packet to
the destination host. The whole process is very similar to a relay race. Each router
focuses only on finding an optimal route and forward packets to the next station
along that route. In this way, packets are delivered from one router to the next until
they reach their destinations. However, packets do not always travel in a best route
if some routing policies interfere in. In the example above, RTA is going to send a
packet to a destination in network N. By searching the routing table, RTA finds the
egress to network N is E0/0 and the next hop router is RTB. Then RTA sends out the
packet through E0/0 to RTB and RTB forwards the packet to RTC in the same way
and so on until the last router RTC sends the packet to network N. The packet is
sent following the route RTA-RTB-RTC-network N.
Copyright © Huawei Technologies Co., Ltd. All rights reserved. Page 3
Here we take the previous example to explain the process of IP routing. As the above figure
shows: RTA connects with network [Link] on the left and RTC connects with network
[Link] on the right. Here is a datagram to be sent from network [Link] to network
[Link]. The process of IP routing is as follows: The packet is sent to E1 port of RTA that
directly connects with network [Link]. After receiving the packet, RTA looks up the routing
table and finds that the next hop to the destination is [Link] and the egress is E0. Then the
packet is sent out from E0 to [Link]. When the packet reaches E0 port of network [Link],
RTB looks up its routing table to find the route to the destination of the packet. The routing
table tells that the next hop to the destination is [Link] and the egress is E1. Then the packet
is sent out from E1 to head for its next hop, network [Link]. When the packet reaches E0
port of network [Link], RTC looks up its routing table and finds that the destination of the
packet is in its own segment and the next hop for the packet is [Link] and the egress is E1.
Then the packet is sent out from E1 to its destination.
Copyright © Huawei Technologies Co., Ltd. All rights reserved. Page 4
Copyright © Huawei Technologies Co., Ltd. All rights reserved. Page 5
Routes in the routing table can be sorted to three categories according to their sources:
Routes found by data-link layer protocols (interface routes or direct routes)
Static routes manually configured by network administrators.
Routes found by dynamic routing protocols.
Copyright © Huawei Technologies Co., Ltd. All rights reserved. Page 6
The proto filed in the routing table indicates the source of the routes. Routes come from three
sources. The first source is the data-link layer. When data-link layer protocols are up, routes of
this sort are generated and their proto field value in the routing table is “direct”. Routes
discovered by the data-link layer do not need maintenance, which reduces the workload.
However, data-link layer can only find routes to segments directly connected with its interfaces
and can not discover routes that cross segments. Routes that cross segments can only be
discovered by other methods.
Copyright © Huawei Technologies Co., Ltd. All rights reserved. Page 7
The first route is statically configured routes.
Static routes are configured by administrators manually and they can also help to make
networks connected. But static routes cannot make adjustments by themselves when networks
fail. They must be changed by administrators.
Copyright © Huawei Technologies Co., Ltd. All rights reserved. Page 8
The last group of routes are discovered by dynamic routing protocols.
Configuring routes statically for a network with a complicated topology is a demanding task
and may result in errors easily. So it is better to use dynamic routing protocols to find and
change routes, which does not need manual maintenance. However, the cost of dynamic
routing protocols is huge and it is rather complicated to configure dynamic routing protocols.
As the figure above shows, routes whose Proto field values are RIP and OSPF are routes
discovered by RIP dynamic routing protocol or OSPF routing protocol.
Details about dynamic routing protocols will be given later.
Copyright © Huawei Technologies Co., Ltd. All rights reserved. Page 9
As we mentioned just now, routes come from three sources. Here, we make a comparison
between static routes and dynamic routes. Static routes must be defined by administrators.
When the network topology changes, administrators have to change the configurations of
static routes manually. Static routes are more suitable for simple and small networks. If the
network is complicated, static routes cannot cope with it. Routing protocols collect network
information for dynamic routes. When the network topology changes, routers update their
information automatically without the help of administrators.
Copyright © Huawei Technologies Co., Ltd. All rights reserved. Page 10
Routing protocol is a language that works for the communication between routers. With
the routing protocol, routers can share information about routes and network status.
Only routers that use the same language can communicate with each other. Routers that
do not speak the same language may obtain information from each other with other
approaches, but it will not be discussed here. Routing protocols set down a set of rules
for the communication between routers. And routers maintain their routing tables and
offer the best routes through routing protocols.
Copyright © Huawei Technologies Co., Ltd. All rights reserved. Page 11
An AS is a set of networks under unified management.
According to their working area, routing protocols can be divided into: Interior Gateway
Protocol (IGP): a protocol for exchanging routing information between gateways within an
autonomous network. The protocols we introduce here like RIP and OSPF are IGP protocols.
Other IGP protocols that are not mentioned here include ISIS, IGRP and EIGRP. Exterior
Gateway Protocol (EGP): a protocol for exchanging routing information between two
autonomous systems. The Border Gateway Protocol (BGP) is a kind of EGP.
Copyright © Huawei Technologies Co., Ltd. All rights reserved. Page 12
According to the algorithms used, routing protocols can be divided into the following
categories: Distance-Vector routing protocol: RIP and BGP. BGP is also called the Path -
Vector Protocol. Link-State Protocol: OSPF and IS-IS.
The differences between the algorithms used by the Distance-Vector routing protocols and
the Link-State protocols lie in the way they find and calculate routes. Distance-Vector
routing protocols concern about the hops to the destination, while Link-State protocols care
more about the network topology and bandwidth resources.
Copyright © Huawei Technologies Co., Ltd. All rights reserved. Page 13
Routing protocols can be divided into unicast routing protocols and multicast routing protocols
according to their applications.
Unicast is one of the data transmission modes. In this mode, the destination of a datagram is
unique, which can be a host or a device.
Multicast is another data transmission mode. In this mode, the destination address is a multicast
address, which means a group of hosts or devices can receive a datagram at the same time.
Here, we only focus on unicast routing protocols. For details about multicast routing protocols,
see references for multicast modules.
Copyright © Huawei Technologies Co., Ltd. All rights reserved. Page 14
Routing table plays a key role in packets forwarding. Each router holds a routing table and every entry in
the routing table tells a packet should be sent through which physical port of a router to reach a subnet
or a host before the packet arrives at the next hop router or its destination.
A routing table contains the following items:
Destination: indicates the destination or the destination network of an IP packet.
Mask: We have already learned the structure and functions of mask in our TCP/IP course. Similarly,
network masks are important information in a routing
table. If we let an IP address and a network mask go through a logical AND operation, we can get
information about the network segment. As the example here, the destination address is [Link] and the
mask is [Link]. After they go through the logical AND, we may know that the segment is [Link]/8
which is a Class A address. Another function of network masks is that when there are multiple route
entries to the same destination in a routing table, the router can choose the route with the longest mask.
Interface: indicates which interface an IP packet should be forwarded from.
Nexthop: indicates the IP address of the next interface that an IP packet will go through.
Other fields in the routing table will be discussed later.
Copyright © Huawei Technologies Co., Ltd. All rights reserved. Page 15
Routes to the same destination may come from different sources. So the next hop of those
routes may be the same or different. In this case, how routers
make their choice about those routes? Route preference is here for this problem.
In the figure above, there are two routes to the segment [Link]: R0 and R1. R0 is discovered
by RIP protocol and R1 is discouted by OSPF protocol. By default, OSPF has a higher route
preference level than that of RIP . So routers use the route discovered by OSPF in this occasion
and add it to the global routing table for packet forwarding.
Copyright © Huawei Technologies Co., Ltd. All rights reserved. Page 16
The default route preference on VRP platform is shown in the above table.
Preference 0 is for direct routes and 255 is for untrustworthy routes. Except direct routes, the
preference of all dynamic routing protocols can be configured manually according to the
requirements of our customers. And you should note that usually a preference is for all routes of
the protocol with that preference. For example, routes discovered by IS-IS have the same
preference 15. The static route is an exception because each static route may have its own
preference. Operator can adjust preference to control routes. If router receives one route by IBGP
source and EBGP source together, It will select EBGP source according BGP protocol's principle.
255 is maximum value for preference. Routes learned from IGP source is more credible than those
from BGP source. By default the preference of IBGP and EBGP is set to 255.255 means the most
untruthful.
Copyright © Huawei Technologies Co., Ltd. All rights reserved. Page 17
The route metric tells the cost of a route to its destination. Route metrics are often decided by
factors including the delay, bandwidth, line occupation rate, line reliability, hops and the
maximum transmission unit. Different dynamic routing protocols choose different factors to
calculate a route cost. For example, RIP uses hops to calculate the route metric. Route metrics
make sense only for routes discovered by the same routing protocol. It is meaningless to compare
route metrics calculated by different protocols and there is no formula to make conversions
between route metrics come from different routing protocols.
The route metric of the static route is 0.
Router A learns routes to Router D from Router B and Router E with the same protocol. As the
figure above illustrates, the route metric of the route that Router A gets from Router B is 9. While
the route metric of the route that Router A gets from Router E is 12. Obviously, the route that
Router A gets from Router B is better than the route Router A learns from Router E. So Router A
adds the first route to its routing table. Router B is the next hop for that route.
Copyright © Huawei Technologies Co., Ltd. All rights reserved. Page 18
If there are multiple routes to the same destination and their route metrics and route preference
are the same, all these routes will be added to the routing table. IP packets are sent on these
routes alternatively, which helps to realize the load balancing.
At present, routing protocols that support load balancing are RIP, OSPF, BGP and IS-IS. The static
route also supports load balancing.
Copyright © Huawei Technologies Co., Ltd. All rights reserved. Page 19
In the routing table above, there are three routes to the network [Link]/32. The three routes
have the same preference and the preference is the highest
preference. So all the three routes are added to the routing table to share the balance of the
load.
Copyright © Huawei Technologies Co., Ltd. All rights reserved. Page 20
Data packets are forwarded according to the IP addresses of their destinations.
When a packet reaches a router, the router first gets to know the IP address of the destination of
the packet and then looks up its routing table to make the logical AND operation for the IP
address and the mask in the table. If the result of the logical AND operation agrees with the
destination IP address of the entry in the table, it means the entry is the route to the destination
of the IP packet;
Otherwise, it is not. When all the entries that meet the requirement are found, the router will
choose the one with the longest mask among them.
Copyright © Huawei Technologies Co., Ltd. All rights reserved. Page 21
Imagine that a packet whose destination IP address is [Link] reaches the router.
The router looks up its routing table and finds three matching routes there. They are:
• [Link]/0 whose matching length is 0 bit.
• [Link]/8 whose matching length is 8 bits.
• [Link]/16 whose matching length is 16 bits.
The last route has the longest mask length. So the router will choose this one to forward the packet
through serial 0/0.
Copyright © Huawei Technologies Co., Ltd. All rights reserved. Page 22
Routing loop is a network problem in which packets are sent from one router and return back to
the router after traveling in the network for a while. When the routing loop problem occurs,
packets travel around several routers until they are discarded when TTL is 0, which wastes the
network resource quite a lot. So we should take methods to keep routing loops at bay.
As the figure above shows, RTA has a packet heading for network N. So it forwards the packet to
RTC and the value of TTL is one less than before at this moment. When RTC receives the packet, it
forwards it to RTB for a routing loop occurs. Now, the TTL value reduces one again. Then RTC
receives the packet and forwards it to RTA and then RTA sends the packet to RTC again. This
process continues until the packet is discarded when the TTL value reduces to 0.
The routing loop is very harmful to the network. We should avoid it as much as we can.
The possible causes for a routing loop may be:
A temporary loop occurs when the network converges
Algorithm defect
Information that can prevent routing loops is lost when routes are imported to different
routing domains.
Configuration mistakes
Copyright © Huawei Technologies Co., Ltd. All rights reserved. Page 23
Copyright © Huawei Technologies Co., Ltd. All rights reserved. Page 24
Copyright © Huawei Technologies Co., Ltd. All rights reserved. Page 25