Professional Documents
Culture Documents
Tema 4.
IP Routing
Alberto Arellano A. Ing. Msc.
aarellano@espoch.edu.ec
CCNA – CCNP - CCSP
1
What is a Router?
physical layer:
bit-level reception
decentralized switching:
data link layer:
e.g., Ethernet given datagram dest., lookup output
port using forwarding table in input
port memory
goal: complete input port processing
at ‘line speed’
queuing: if datagrams arrive faster
than forwarding rate into switch fabric
Switching Fabric
The switching fabric is at the heart of a router.
Through it the packets are actually moved from
an input port to an output port.
Switching Fabric Functions
• Transfer packet from input buffer to appropriate output
buffer
• Switching rate: rate at which packets can be transfer from
inputs to outputs
• often measured as multiple of input/output line rate
• N inputs: switching rate N times line rate desirable
2T
A router needs a buffer size: B 2T C
2T is the two-way propagation delay (or just 250ms)
C is capacity of bottleneck link
e.g., C = 10 Gps link:
2.5 Gbit buffer
Recent recommendation:
with N flows(Typical backbone link has > 20,000
flows),buffering equal to
RTT. C
a a
b b
c c
Processor
Forwarding Table
Prefix Output Link
f 0 a f
00 b
01 c
1 d
10 e
1100 f
1101 g
1110 h
i 1111 i i
Router
Example: 00 P5
01 P4
Prefixes: 10 P1
P1 : 10*
11 P2
P2 : 11*
000
P3 : 11001* 00000 P6
P4 : 1* 001 P3
00001
P5 : 0* 010
P6 : 1000000* 00010 011
00011
:
100
:
11111 101
Assume that the stride for the root of some tree is 2; 110
And that for the root’s left child is 5; 111
And that for the root’s right child is 3.
Router
Input Links Switch Output Links
a 1100 a
b b
c c
Processor
1100
Forwarding Table
f f Prefix
0
00
01
Output Link
a
b
c
f
Compressed 1 d
1-Bit Trie Algorithm 10 e
1100 f
1101 g
1110 h
i 1111 i i
Router
Input Links Switch Output Links
a 1100 a
b b
c c
Processor
Forwarding Table
Prefix Output Link
f 0 a f
00 b
01 c
1 d
10 e
Centralized 1100 f
1101 g
Switching 1110 h
i 1111 i i
Router
Input Links Switch Output Links
a a
b b
c c
Processor
Forwarding Table
Prefix Output Link
f 00 0 a f
00 b
01 c
1 d
10 e
Decentralized 1100 f
1101 g
Switching 1110 h
i 1111 i i
Forwarding
Forwarding means to place the packet in its route to its
destination. Forwarding requires a host or a router to have a
routing table. When a host has a packet to send or when a
router has received a packet to be forwarded, it looks at this
table to find the route to the final destination.
Techniques for
Forwarding Packets
Source Routing
Packet carries path
Table of virtual circuits
Connection routed through network to setup
state
Packets forwarded using connection state
Table of global addresses (IP)
Routers keep next hop for destination
Packets carry destination address
Source Routing
List entire path in packet
Driving directions
IPv4
LSSR – Lose Source Routing options
IPv6
RH0 – Type 0 Routing Header extension
Virtual Circuits/Tag
Switching
Use the telephone model virtual circuits
Each flow is identified by a Virtual Circuits Identifier (VCI).
Connection setup phase, Signaling
Use other means to route setup request
ID/port
Each packet carries connection ID
Sent from source with 1
st hop connection ID
Router processing
Lookup flow ID – simple table lookup
Packet 5 7
2 2
Sender
1
R1 3 1
R2 3
1,7 4,2
4 4
1,5 3,7 2
2
1
R3 Receiver
3
4 6
2,2 3,6
Forwarding with
Classfull Address
Forwarding with
Classless Address
IP Routing
Network topology
Network load
Datagram length
IP routing software:
Normally does not consider most of these factors
shortest paths
Processing of an IP
packet/datagram
Host route
Destination address is an interface address (e.g., 10.0.1.2/32)
Default route
Used when no network or host route matches
The router that is listed as the next hop of the default route is the
default gateway.
Loopback address
Routing table for the loopback address (127.0.0.1)
Connected Routes
Static Routes
Routing table lookup:
Longest Prefix Match
Longest Prefix Match: Search for the 128.143.71.21
routing table entry that
= has the longest
match with the prefix of the destination IP
address
Destination addressNext hop
10.0.0.0/8 R1
1. Search for a match on all 32 bits 128.143.0.0/16 R2
2. Search for a match for 31 bits 128.143.64.0/20 R3
128.143.192.0/20 R3
….. 128.143.71.0/24 R4
32. Search for a match on 0 bits 128.143.71.55/32 R3
0.0.0.0/0 (default) R5
ICMP messages
Routing table
manipulations with ICMP
When a router detects that an IP
datagram should have gone to a
different router, the router (here R1)
forwards the IP datagram to
the correct router (R2)
sends an ICMP redirect
message to the host
Host uses ICMP message to update
its routing table
Routing Component
Three important routing elements :
algorithm
database
protocol
router
Routing Metrics
How do we decide that one route is better
than another?
Solution : using a metric as a measurement
to compare routes
Metrics may be: distance, throughput,
delay, error rate, and cost.
Today, IP supports Delay, Throughput,
Reliability and Cost (DTRC).
Routing Protocol determine the best path
based on the route with the lowest cost.
Hop Count = Distance
A hop is defined as a passage through
one router
2 hops
1 hop 1 hop
R1 R2
1 hop 1 hop
R3
Routing Algorithm Types
Unicast vs Multicast
Static vs Dynamic
Source routing vs Hop-by-hop
Distance vector vs Link state
54
Routing Algorithm:
Unicast
In unicasting, the router forwards the received
packet through only one of its interfaces (1
source 1 destination)
Routing Algorithm:
Multicast
In multicasting, the router may forward the
received packet through several of its interfaces
Routing Algorithm:
Static Route
Manually configuration routing table
Can’t react dynamically to network change such as router’s
crash
Work well with small network or simple topology
Unix hosts use command route to add an entry
Cisco Router use command ip route to add an entry
Juniper Routers use command set routing-options static route
to add entry.
point to point
connection
route to this
way only, no need
for update
Routing Algorithm:
Static Route Linux
Routing Algorithm:
Dynamic Route
Network protocol adjusts automatically for topology
or traffic changes
A local 0 B local 0
Letters represent
Node names
A B
1
6
From D Link Cost D E From E Link Cost
D local 0 E local 0
Operation of Distance
Vector Routing (2)
From A Link Cost From B Link Cost
A local 0 B local 0
A 1 1
B=0, A=1
A B
1
3 4
D=0, A=1
6
From D Link Cost D E From E Link Cost
D local 0 E local 0
A 3 1
Operation of Distance
Vector Routing (3)
From A Link Cost From B Link Cost
A local 0 B local 0
B 1 1 A 1 1
D 3 1 A=0, B=1, D=1
A B
1
C=0, B=1, A=2
2 From C Link Cost
C
C local 0
B 2 1
3 4 A 2 2
6
From D Link Cost D E From E Link Cost
A local 0 B local 0
B 1 1 A 1 1
D 3 1 B=0, A=1, D=2, D 1 2
C=1, E=1 C 2 1
A B E 5 1
1
6
From D Link Cost D E From E Link Cost
A local 0 B local 0
B 1 1 A 1 1
D 3 1 D 1 2
C 1 2 C 2 1
E 1 2 A B E 5 1
1
These do not alter 2 From C Link Cost
routing tables further C C local 0
Thus, no new 3 4
B 2 1
A 2 2
updates generated E 5 1
D 5 2
5
6
From D Link Cost D E From E Link Cost
D local 0 E local 0
A 3 1 B 4 1
B 3 2 A 4 2
E 6 1 D 6 1
C 6 2 C 5 1
Link 6 fails 5
6
From D Link Cost D E
D local 0
A 3 1 D’s routing table
B 6 inf immediately
E 6 inf
C 6 inf after link 6 fails
Drawbacks of Distance Vector
Routing: Counting to “Infinity” (2)
A local 0
B 3 3
D 3 1
C 3 3
E 3 2 A B
1
D transmits its 2
C
updated DV
D=0, A=1, B=4, 3 4
E=3, C=4
6
From D Link Cost D E
D local 0
A 3 1
B 3 4
E 3 3
C 3 4 D updates its routing table
Drawbacks of Distance Vector
Routing: Counting to “Infinity” (3)
A transmits its 2
C
updated DV
3 4
6
From D Link Cost D E
D local 0
A 3 1
B
E
3
3
4
3
We are in an
C 3 4
infinite loop!
Drawbacks of Distance Vector
Routing: Bouncing Effect (1)
2
C
Routes towards C
3 4 From Link Cost
AC 1 2
BC 1 1
5 CC local 0
DC 3 3
6 EC 4 2
From D Link Cost D E From E Link Cost
D local 0 E local 0
A 3 1 A 5 2
B 3 2 B 4 1
C 3 3 C 4 2
E 6 1 D 6 1
Drawbacks of Distance Vector
Routing: Bouncing Effect (2)
All links except 5 have
From A Link Cost unit cost, link 5 cost = 10 From B Link Cost
B’s routing table
A local 0 B local 0 immediately after
B 1 1 A 1 1
C 1 2 C 2 inf link 2 fails
D 3 1 D 1 2
E 3 2 A B E 4 1
1
Link 2 fails
A=0, B=1, C=2, 2
D=1,E=2 C
Routes towards C
A transmits its DV 3 4 From Link Cost
before B does AC 1 2
BC 2 inf
5 CC local 0
DC 3 3
6 EC 4 2
From D Link Cost D E From E Link Cost
2
C
Routes towards C
3 4 From Link Cost
AC 1 2
BC 1 3
A’s DV produces 5 CC local 0
no change at D DC 3 3
6 EC 4 2
From D Link Cost D E From E Link Cost
D local 0 E local 0
A 3 1 A 6 2
B 3 2 B 4 1
C 3 3 C 4 2
E 6 1 D 6 1
Drawbacks of Distance Vector
Routing: Bouncing Effect (4)
All links except 5 have unit
From A Link Cost cost, link 5 cost = 10 From B Link Cost
A local 0 B local 0
B 1 1 A 1 1
C 1 4 C 1 3
D 3 1 D 1 2
E 3 2 A B E 4 1
1
Further DV exchanges 2
produce no change in C
Routes towards C
routing tables! Both 3 4 From Link Cost
routing and distances AC 1 4
have (temporarily) Loop! BC 1 3
stabilized 5 CC local 0
DC 3 3
6 EC 4 4
From D Link Cost D E From E Link Cost
D local 0 E local 0
A 3 1 A 6 2
B 3 2 B 4 1
C 3 3 C 4 4
E 6 1 D 6 1
80
R2 SPF Tree
81
R3 SPF Tree
82
R4 SPF Tree
83
R5 SPF Tree
84
Link-State Routing Process
1. Each router learns about its own links, its own directly connected networks.
(Interface is “up”)
2. Each router is responsible for meeting its neighbors on directly connected
networks. (OSPF Hello packets)
3. Each router builds a link-state packet (LSP) containing the state of each
directly connected link. (neighbor ID, link type, and bandwidth)
4. Each router floods the LSP to all neighbors, who then store all LSPs
received in a database.
Neighbors then flood the LSPs to their neighbors until all routers in the
area have received the LSPs.
5. Each router uses the database to construct a complete map of the topology
and computes the best path to each destination network.
The SPF algorithm is used to construct the map of the topology and to
determine the best path to each network. (Road map)
All routers will have a common map or tree of the topology, but each
router will independently determine the best path to each network within
that topology.
Step 1: Learning About
Directly Connected
Networks
Step 1: Each router learns about its own links, its own directly
connected networks.
Interface configured with an IP address/subnet mask.
Link 4
• Network: 10.4.0.0/16
Link states - Information about the state of a • IP address: 10.4.0.1
router’s links • Type of network: Serial
• Cost of that link: 20
This information includes interface’s: • Neighbors: R4
IP address/mask
Type of network
Ethernet (broadcast) or serial point-to-point
link
Cost of that link
Any neighbor routers on that link
Step 1
Initially:
Router unaware of any neighbor routers on the
link.
Learns of neighbor when receives a Hello
packet from the adjacent neighbor.
Hello, I’m
R2
Hello, I’m R1
Hello, I’m
Step 2: R3
Sending Hello
Packets to
Neighbors Hello, I’m
R4
Hello, I’m R1
& still here
Step 2: Sending
Hello, I’m R3 &
Hello Packets to still here
Neighbors
Hello packets
“Keepalive” function
Stops receiving Hello packets from a neighbor, that
neighbor is considered unreachable and the
adjacency is broken.
Step 3: Building
the Link-State
Packet
Step 4: Each router floods the LSP to all neighbors, who then store all
LSPs received in a database.
Each router floods its link-state information to all other link-state routers.
When a router receives an LSP from a neighboring router, sends that
LSP out all other interfaces, except the interface that received the LSP.
Flooding effect of LSPs throughout the routing area.
Link-state routing protocols calculate the SPF algorithm after the flooding is
complete.
Step 4: Flooding Link-State
Packets to Neighbors
Step 5:
Constructing a
Link-State
Database
Step 5 (Final Step):
Each router uses the
database to construct a
complete map of the
topology and computes
the best path to each
destination network.
Each router in the routing area can now use the SPF
algorithm to construct the SPF trees that you saw earlier.
Step 5: Constructing a
Link-State Database
The SPF algorithm begins by processing the following LSP information from R3:
Connected to neighbor R1 on network 10.3.0.0/16, cost of 5
Connected to neighbor R4 on network 10.7.0.0/16, cost of 10
Has a network 10.6.0.0/16, cost of 2
R1 Processes the LSPs from R4
Red: New
information
for tree.
The SPF algorithm begins by processing the following LSP information from R4:
Connected to neighbor R1 on network 10.4.0.0/16, cost of 20
Connected to neighbor R3 on network 10.7.0.0/16, cost of 10
Connected to neighbor R5 on network 10.10.0.0/16, cost of 10
Has a network 10.8.0.0/16, cost of 2
R1 Processes the LSPs from R5
Red: New
information
for tree.
The SPF algorithm begins by processing the following LSP information from R5:
Connected to neighbor R2 on network 10.9.0.0/16, cost of 10
Connected to neighbor R4 on network 10.10.0.0/16, cost of 10
Has a network 10.11.0.0/16, cost of 2
SPF Tree
Using the SPF tree, SPF algorithm results in the shortest path
to each network.
Note: Only the LANs are shown in the table, but SPF can
20
Determining the
Shortest Path
Determining the
Shortest Path
2
5
10
10
108
Network 10.9.0.0/16
via R2 Serial 0/0/0
at a cost of 30
10
Determining the 20
Shortest Path
109
Determining the
Shortest Path
5
10
10
Network 10.10.0.0/16
via R3 Serial 0/0/1
at a cost of 25
110
Network 10.11.0.0/16 via
R3 Serial 0/0/1 at a
Determining the cost of 27
Shortest Path
5 2
10
10
111
Determining the
Shortest Path
These paths listed previously can now be added to the routing table.
The routing table will also include
Directly connected networks
Routes from any other sources, such as static routes.
Packets will now be forwarded according to these entries in the routing
table.
Advantages of Link-State
Routing Protocols
• LS routing protocols exchange link-states, and can therefore use the
Builds a SPF algorithm to build an SPF tree of the network.
Topological Map • Using the SPF tree, each router can determine the shortest path to
every network.
• When receiving an LSP, LS protocols immediately flood the LSP out all
interfaces except for the interface from which the LSP was received.
Fast Convergence • In contrast, RIP processes each message, updates the routing table,
then flood to the next neighbour.
• After the initial flooding of LSPs, link-state routing protocols only send
Event-driven
out an LSP when there is a change in the topology.
Updates • The LSP contains only the information regarding the affected link.