Вы находитесь на странице: 1из 79

1

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
Course Name

Routing is the process of selecting paths (or routes) in a network along which
data will be forwarded
Routing is a function of routers
As can be seen in the diagram, routers are in the core of the network to
interconnect different networks together
Routers uses store-and-forward, packet switching technique to forward packets
from source to the correct destination
In the given example
RTA is sending packets to a destination in network N
By searching the routing table, RTA finds the outgoing interface to N is E0/0, and
the next hop router is RTB
Then RTA sends the packet through E0/0 to RTB
By using the same operations, RTB forwards the packet to RTC, which in turn
sends to the destination network, N

Confidential Information of Huawei. No


Spreading Without Permission P-43
Course Name

The routing process shows that packet forwarding is dependent on the information in
the routing table
To function effectively, a router should
Check the destination of a packet — does the router have information about the
destination of the packet?
Determine the source of the information — where is the information about the
route to the destination from? Is it defined by the administrator statically? Or is it
obtained from other routers?
Find possible routes — what are the possible routes to the destinations?
Select the best route — which is the best route to the destination? Should the
router use the load balancing mechanism to send the packet by multiple routers?
Verification and maintenance of routing information — is a route valid? Is it the
latest? Routers have to verify and maintain routing information to ensure that
the information is correct.

Confidential Information of Huawei. No


Spreading Without Permission P-44
Course Name

An example of routing table is given in the next slide


Typically, a routing table includes the following information:
Destination address
Network mask
Outgoing interface
Next hop
Additional information such as the cost of the route, the protocol/mechanism used to
determine the routes, preference or priority are included in commercial router platform

Confidential Information of Huawei. No


Spreading Without Permission P-45
Course Name

In the sample routing table of a router:


Destination/Mask: The destination network and the number of bits used in
subnet mask
Proto: the protocol/mechanism from which the routers are learned
Direct — indicate that the route is discovered by data link layer protocol
Static — indicate that the route is statically configured
Pre: preference value to determine the priority of the route
Cost: the cost of using the route
Flags: additional information
NextHop: IP address of the next hop router
Interface: the outgoing interface for the route

Confidential Information of Huawei. No


Spreading Without Permission P-46
Course Name

In the example, RTA is connected to network 10.3.1.0 on the left and RTC is connected
with network 10.4.1.0 on the right
A packet (datagram) is to be sent from network 10.3.1.0 to network 10.4.1.0
The routing process is as follows:
1. The packet is sent to E1 port of RTA that is directly connected with network
10.3.1.0. After receiving the packet, RTA looks up the routing table and finds
that the next hop to the destination is 10.1.2.2, and the egress is E0. The
packet is then sent out from E0 to 10.1.2.2.
2. When the packet reaches E0 port of network 10.1.2.2, RTB looks up its
routing table and finds that the next hop to the destination is 10.2.1.2, and
the egress is E1. The packet is then sent out from E1 to 10.2.1.2.
3. When the packet reaches E0 port of network 10.2.1.2, 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 10.4.1.1, and the egress is E1. The
packet is then sent out from E1 to the destination.

Confidential Information of Huawei. No


Spreading Without Permission P-47
Course Name

The example zooms in to illustrate the forwarding process a packet destined for network
10.4.1.101
Consider router X receives the packet
X looks up its routing table, and finds that the closest match to the destination is
10.4.1.0 — the lookup is based on a concept called longest prefix match (see
next slide)
The corresponding next hop and outgoing interface are 10.1.2.2 and E0,
respectively
The packet is forwarded to 10.1.2.2 through E0

Confidential Information of Huawei. No


Spreading Without Permission P-48
Course Name

The longest prefix matching algorithm is used to find the corresponding routing entry for
a given destination IP address
The process:
1. For the given destination IP address, router performs logical AND operation
with network mask — the result is a network address
2. The resultant network address is compared with the addresses in the routing
table
3. The comparison is done at bit level — the entry with IP address that matches
the longest prefix of the destination IP is selected

Confidential Information of Huawei. No


Spreading Without Permission P-49
Course Name

Given destination IP address: 9.1.2.1


The router tries to find a match in its routing table
There are three matches
0.0.0.0/0 — matching length = 0 bit
9.0.0.0/8 — matching length = 8 bits
9.1.0.0/16 — matching length = 16 bits
The third route (9.1.0.0/16) will be used

Confidential Information of Huawei. No


Spreading Without Permission P-50
Course Name

These mechanisms will be discussed shortly

Confidential Information of Huawei. No


Spreading Without Permission P-51
Course Name

Routes-discovered by data link layer


This type of routes are generated as the data link layer protocols are up at the
router interfaces
Routes learned by this technique are labeled as “Direct” in the routing table
Routes discovered by the data link layer do not need maintenance, which
reduces workload
However, data link layer can only discover routes to network segments directly
connected to its interfaces
Routes that cross segments can only be discovered by other methods

Confidential Information of Huawei. No


Spreading Without Permission P-52
Course Name

The example shows the routing table at RTB


In the example, RTB is connected to RTA and RTC via serial lines
This is can been from routes 10.1.1.0/30 and 10.1.2.2/32 which are learned via
“Direct” proto, and the outgoing interface Serial
In the example, all routes shown are learned by data link layer. These routes are marked
as “Direct” in the Proto field

Confidential Information of Huawei. No


Spreading Without Permission P-53
Course Name

Confidential Information of Huawei. No


Spreading Without Permission P-54
Course Name

In the example, at RTA, the first route is statically configured — as indicated by the Proto
field: Static
From the figure, destination (2.2.2.2) is attached to RTB
RTA is connected to RTB via network segment 10.1.1.0/30, RTB interface at this
network segment is 10.1.2.2
Hence, the NextHop for the route is set to 10.1.2.2

Confidential Information of Huawei. No


Spreading Without Permission P-55
Course Name

The syntax for configuring static routes using Huawei’s VRP (Versatile Routing Platform)
ip route-static [destination-network] [subnet-mask] [next hop/exit interface]
In the example, RTB has been configured for static route to 10.1.1.0/24 network using
the next hop address of 1.1.1.1

Confidential Information of Huawei. No


Spreading Without Permission P-56
Course Name

Static route can be verified using the command display ip routing-table in Huawei’s VRP
The routing table shows that the route to 10.1.1.0/24 has been successfully configured
as static route via Serial0

Confidential Information of Huawei. No


Spreading Without Permission P-57
Course Name

Details about dynamic routing protocols will be discussed later

Confidential Information of Huawei. No


Spreading Without Permission P-58
Course Name

At RTB, the last group of routes are discovered by dynamic routing protocols
Route to destination 172.16.1.1/32 is discovered by OSPF (Open Shortest Path
First)
Route to destination 192.168.1.0/24 is discovered by RIP (Routing Information
Protocol)

Confidential Information of Huawei. No


Spreading Without Permission P-59
Course Name

This table compares the static route to the dynamic route

Confidential Information of Huawei. No


Spreading Without Permission P-60
Course Name

In the example, the first route entry is a default route


This is indicated by the destination address: 0.0.0.0/0
The default route will be used when a given destination address cannot be
matched to any other entries

Confidential Information of Huawei. No


Spreading Without Permission P-61
Course Name

In stub network, default routes are typically used to point to the default gateway (router)
In the example, RTA is the default gateway for the stub network
Hence, hosts in the network configure RTA as the default gateway
All packets that are destined for other network segments will be forwarded to
RTA

Confidential Information of Huawei. No


Spreading Without Permission P-62
Course Name

A default route is configured by setting the destination address and mask to be 0.0.0.0
0.0.0.0 when using the command ip route-static
One of the topologies where default routes are used is in a stub network where there is
only one default path for network packets to access the external or greater network

Confidential Information of Huawei. No


Spreading Without Permission P-63
Course Name

The default route has a destination of 0.0.0.0 and mask of 0 in the routing table
In the example shown above, the default route has a next hop address of 1.1.1.2

Confidential Information of Huawei. No


Spreading Without Permission P-64
Course Name

Host route indicates that the destination is an end host


This is indicated by the network mask used: 32 bits or 255.255.255.255
In the example, the first entry with 1.1.1.1/32 is clearly a host route
Note: the last entry 127.0.0.1/32 is a loopback address

Confidential Information of Huawei. No


Spreading Without Permission P-65
Course Name

Black hole route is a route entry that points to a virtual interface (usually referred to as
NULL0) which is always UP
NULL interfaces are created by network administrator
Packets matching a black hole route will be discarded. Black hole routing is usually used
for security and loop prevention
In the example, packets destined for 1.1.1.1/32 will be sent to NULL0 interface — they
will be discarded

Confidential Information of Huawei. No


Spreading Without Permission P-66
Course Name

Routes to the same destinations may come from different sources — the next hop of
those routes may be different
In this case, routers need to decide which route will be used. This is done based on route
preference
In the example, there are two routes to the network segment 10.0.0.0
The first route (R0) is discovered by RIP and the second route (R1) is discovered
by OSPF
By default, OSPF has a higher route preference level than that of RIP
So router will choose the route discovered by OSPF and add it to the global
routing table for packet forwarding

Confidential Information of Huawei. No


Spreading Without Permission P-67
Course Name

The table lists the default preference on Huawei VRP platform


Preference 0 refers to direct routes and 255 is for untrusted routes
Except for direct routes, the preference of all dynamic routing protocols can be
configured manually according to the requirements of network
administrators/operators
Operators can adjust the preference to control how routing will be done
Note that a preference is typically set for all routes discovered by the same
protocol
For example, all routes discovered by IS-IS have the same preference of
15
An exception are routes discovered by static configuration — each static
route may have its own preference
From the table, we can observe that routes learned from IGP (Interior Gateway
Protocol) are considered more credible that those learned from the Border
Gateway Protocol (BGP)
In the table, both IBGP (Interior Border Gateway Protocol) and EBGP (Exterior
Border Gateway Protocol) have the same preference value
In this case, based on BGP working principle, EBGP route will be selected

Confidential Information of Huawei. No


Spreading Without Permission P-68
Course Name

Route metric gives the cost of route to its destination. It is used by routing protocol to
determine the best path to the destination
Typically used route metric:
Hop count
Link bandwidth
Link delay
Link load
Link reliability
Link MTU
Cost
For example, RIP uses hop count as route metric
Route metrics make sense only for routes discovered by the same routing
protocol. Hence it is meaningless to compare route metrics calculated by different
protocols and there is no formula to convert between route metrics from different
routing protocols
The route metric of the static route is 0

Confidential Information of Huawei. No


Spreading Without Permission P-69
Course Name

Path cost: sum of route metric on each of the links along the path
In the example, Router A learns route to Router D from Router B and Router E using the
same protocol
From the figure, the path cost from A to D via B is 9; the path cost from A to D via E is 12
Obviously the route via B is better than the route via E
So A will add the first route to its routing table, and set Router B as the next hop for the
route

Confidential Information of Huawei. No


Spreading Without Permission P-70
Course Name

Confidential Information of Huawei. No


Spreading Without Permission P-71
Course Name

In the example, there are two ECMP from A to D:


A->B->C->D
A->C->D
Even though both paths have different path length, they have similar path cost or 18
With ECMP, both paths will be added to the routing table. IP packets can be sent on
these paths alternatively to realize load balancing
At present, routing protocols that support load balancing are: RIP, OSPF, BGP and IS-IS.
The static route also supports load balancing.

Confidential Information of Huawei. No


Spreading Without Permission P-72
Course Name

The example shows the routing table for router RTB.


It shows there are three routes to destination 10.1.1.1/32. These routes are statically
configured
These three routes have the same preference
So, all the three routes are added to the routing table for load balancing

Confidential Information of Huawei. No


Spreading Without Permission P-73
Course Name

Routing loop is a network problem in which packets transferred between two or more
routers circularly
As in the figure, a routing loop is formed between RTA, RTB and RTC for packets
destined for Network N
Due to the loop, packet will be circulated from RTA to RTC, RTC to RTB, RTB back
to RTA, and so on
The TTL value in the packet is used to prevent the packet from circulating in the
network endlessly
In particular, when RTA receives the packet, it decrements the packet’s TTL value
by 1 and forwards it to RTC; when RTC receives the packet, it decrements the
packet’s TTL value by 1 and forwards it to RTB;
The above process continues until the packet is discarded when its TTL reaches 0

Confidential Information of Huawei. No


Spreading Without Permission P-74
Course Name

Routing loop is harmful to the network as it wastes network resources. Hence it


should be avoided
Causes of routing loop:
Transient routing loop during route convergence process
Errors in routing protocol
Loss of loop prevention information when routes are imported from one
domain to another domain
Configuration errors

Confidential Information of Huawei. No


Spreading Without Permission P-75
Course Name

At RTB, the last group of routes are discovered by dynamic routing protocols
Route to destination 172.16.1.1/32 is discovered by OSPF (Open Shortest Path
First)
Route to destination 192.168.1.0/24 is discovered by RIP (Routing Information
Protocol)

Confidential Information of Huawei. No


Spreading Without Permission P-76
Course Name

In the example, the first route entry is a default route


This is indicated by the destination address: 0.0.0.0/0
The default route will be used when a given destination address cannot be
matched to any other entries

Confidential Information of Huawei. No


Spreading Without Permission P-77
Course Name

Best effort service model basically means no service is provided: there is no guarantee
on delay, bandwidth and packet lost rate.
For packets trapped in a routing loop, they will eventually discarded by the routers when
their TTL reach zero.
A packet of 1000 bytes:
3 fragments will be created.
Actual payload: 1000 – 20 (IP header) = 980
First fragment can accommodate: 480 bytes of data
2nd fragment can accommodate: 480 bytes of data
3rd fragment will store the remaining: 980 – 480 – 480 = 20 bytes of data.
Unicast routing means one-to-one; multicast routing is one-to-many or point to
multipoint.
Traceroute operation: refer to Page 96.

Confidential Information of Huawei. No


Spreading Without Permission P-78
79