Routing - UW Faculty Web Server

CSS432 Routing
Textbook Ch3.3
Prof. Athirai Irissappane
http://courses.washington.edu/css432/athirai/
[email protected]
CSS 432: Routing
1
What Is Routing?

Forwarding vs Routing
 forwarding:




To map a network # to an outgoing interface and some MAC
information in a forwarding table.
To send a packet to an interface as consulting a local and static
forwarding table
OSI Layer 2: data link level
Implemented in specialized hardware (switch)
 routing:




To build a dynamic routing table
To update table contents in a dynamic and distributed fashion
OSI Layer 3: network level (internet)
Using complex distributed algorithms
CSS 432: Routing
2
Routing
• Network as a Graph
• The basic problem of routing is to find the lowest-cost path
between any two nodes
• Where the cost of a path equals the sum of the costs of all
the edges that make up the path
Routing
• For a simple network, we can calculate all shortest paths and
load them into some nonvolatile storage on each node.
• Such a static approach has several shortcomings
• It does not deal with node or link failures
• It does not consider the addition of new nodes or links
• It implies that edge costs cannot change
• What is the solution?
• Need a distributed and dynamic protocol
• Two main classes of protocols
• Distance Vector
• Link State
Distance Vector

Each node maintains a set of triples
 (Destination, Cost, NextHop)

Starting assumption is that each node
knows the cost of the link to each of its
directly connected neighbors
B
An initial distance vector at node A
Destination
Cost
Next hop
B
1
B
C
1
C
D
∞
-
E
1
E
F
1
F
G
∞
-
C
A
D
E
F
CSS 432: Routing
G
5
Distance Vector
Initial distances stored at each node (global view)
Distance Vector

The distance vector routing algorithm is sometimes
called as Bellman-Ford algorithm

Every T seconds each router sends its distances to its
neighbor who then updates their table based on the new
information

Problems include fast response to good news and slow
response to bad news. Also too many messages to
update
Distance Vector


Exchange updates directly connected neighbors
 periodically (on the order of several seconds)
 whenever table changes/ notices failure (called triggered
update)
A
Each update is a list of pairs (the routing table):
 (Destination, Cost) (and next hop)








(C, 1, C) < (C, 2, B)
(D, ∞, - ) > (D, 2, C)
From F: (G, 1)

D
G
F
From C: (D, 1)

C
E
From B: (A, 1), (C, 1)
From C: (A, 1), (B, 1), (D, 1)
From E: (A, 1)
From F: (A, 1), (G, 1)
Update local table if receive a “better” route
 From B: (C,1)

B
(G, ∞, - ) > (G, 2, F)
Refresh existing routes; delete if they are expired
CSS 432: Routing
Destination
Cost
Next hop
B
1
B
C
1
C
D
2
C
E
1
E
F
1
F
G
2
F
8
Distance Vector

F sends (G, 1) to A




C sends (D, 1) to A



F can reach G with cost 1
A can reach F with cost 1
A can reach G with cost 2 (< infinity so update table)
C can reach D with cost 2
A can reach D with cost 2 (< infinity so update table)
C sends (B,1) to A

A can reach B with cost 2 (> 1 so do not update table)
Distance Vector
Final distances stored at each node (global view – not
known by the routers, who only know their row entry)
Distance Vector
The routing table at each node stabilizes,
i.e., become consistent, converges
 Updates from neighbors

 Periodically
 Triggered
Node notices a link failure
 Receives an update from neighbors that causes a
change in its routing table

Routing Loop

Failure-recovering scenario
 F detects the link to G has failed
 F sets distance to G to ∞ and sends an update to A
 A sets distance to G to ∞
 A receives periodic update from C with a 2-hop path
to G
 A sets distance to G to 3 and sends update to F
 F sets distance to G in 4 hops via A
CSS 432: Routing
B
C
A
D
E
F
∞
G
12
B
Count-to-infinity problem
1.
2.
3.
4.
The link from A to E fails
(triggered/periodic update)
A advertises (to neighbors) , (E, ∞)
At same time, C does not know
A
about E, as periodic update,
Destination
advertises (E, 2)
B decides it can reach E in 3 hops B
(via C)
C
B
Destination
Cost
Next hop
1
B
A
1
A
1
C
C
1
B
D
2
C
D
2
C
E
14
∞
B
E
E
23
C
A
A decides it can reach E in 4 hops F
(via B)
G
1
F
F
2
A
2
F
G
3
A
3.
1.
2.
3.
7.
G
F
Next hop
2.
6.
E
Cost
1.
5.
C
A
B receives (E, ∞) from A, (E, 2) from C
B changes its Routing table (triggers
update)
B advertises (E, 3)
A receives (E, 3) from B
Routing table of A has changes
(triggered update)
A advertises (E, 4)
C decides that it can reach E in 5
hops…
Cycle goes on until cost get near to
infinity
C
Destination
Cost
Next hop
A
1
A
B
1
B
D
1
D
E
2
5
A
F
2
A
G
2
D
13
Loop-Breaking Heuristics


Set infinity to 16

Scheme: Stop an infinity loop in 16.

Problem: No more 16 hops
Split horizon

Scheme: Don’t send a neighbor the routing information learned from
this neighbor.


Ex. B includes (E, 2, A) and thus doesn’t send (E, 2) to A
Split horizon with poison reverse

Scheme: Send the routing information learned from this neighbor as
setting hop count to ∞.


Ex. B includes (E, 2, A) and thus sends (E, ∞, A)
Problem: Its slow convergence speed for large number of nodes,
works for 2 node case
CSS 432: Routing
14
Routing Information Protocol
(RIP)

Same as Distance Vector Routing (for graph model)

RIP for internetwork

Instead of cost of reaching other routers, it specifies cost of reaching
networks

E.g., Router C advertises to Router A
It can reach Networks 2, 3 at cost 0.
CSS 432: Routing
15
Routing Information Protocol (RIP)
frame header




1: request
2: reply
Port: 520

Used by routed
Advertisement: 30secs
Table entry timeout: 3 mins.

Deleted in 60secs
RIP Message
UDP header
Cmd: 1-6


datagram heaader
Routing domain
Addr family (net addr)
Route tag
Address of net 1
Cmd
Ver
Subnet mask
Next hop address (1-16)
Distance to net 1
Addr family (net addr)
Route tag
Address of net 2
Subnet mask
Next hop address
Distance to net 2 (1-16)
25 entries
https://tools.ietf.org/html/rfc2453
16
Link State Routing
Strategy: Send to all nodes (not just neighbors) information
about directly connected links (not entire routing table).
1. Reliable flooding: Most recent copy of information about
the directly connected links of all nodes
2. Route Calculation: Find the best route to destinations
using the available information
Link State Routing
Strategy: Send to all nodes (not just neighbors) information
about directly connected links (not entire routing table).
 Each node creates Link State Packet (LSP)





id of the node that created the LSP
cost of link to each directly connected neighbor
sequence number (SEQNO)
time-to-live (TTL) for this packet
Reliable Flooding





start SEQNO at 0 when reboot
generate new LSP periodically; increment SEQNO
store most recent LSP (larger the SEQNO, newer the LSP) from
each node
If received LSP is new forward LSP to all nodes but one that
sent it
decrement TTL of each LSP before forwarding; discard when
TTL=0
Link State
Reliable Flooding
Flooding of link-state packets. (a) LSP arrives at node X; (b) X floods
LSP to A and C; (c) A and C flood LSP to B (but not X); (d) flooding
is complete



In practice, each router computes its routing table
directly from the LSP’s it has collected using a realization
of Dijkstra’s algorithm called the forward search
algorithm
Specifically each router maintains two lists, known as
Tentative and Confirmed (route already calculated)
Each of these lists contains a set of entries of the form
(Destination, Cost, NextHop)
# Chapter Subtitle
Shortest Path Routing
Dijkstra’s Shortest-Path Algorithm
1.
2.
3.
Initialize Confirmed list with (myself, 0, -), Tentative with null list
For the node just added to the Confirmed list in the previous step,
call it node Next, select its LSP
For each neighbor (Neighbor) of Next, calculate the cost (Cost)
to reach Neighbor as the sum of the cost from myself to Next and
from Next to Neighbor


4.
If Neighbor is currently on neither the Confirmed nor the
Tentative list, then add (Neighbor, Cost, Nexthop) to the
Tentative list, where Nexthop is the direction I go to reach Next,
If Neighbor is currently on the Tentative list, and the Cost is less
than the currently listed cost for Neighbor, then replace the
current entry with (Neighbor, Cost, Nexthop) where Nexthop is
the direction I go to reach Next
If the Tentative list is empty, stop. Otherwise, pick the entry from
the Tentative list with the lowest cost, move it to the Confirmed
list, and return to Step 2.
CSS 432: Routing
21
Dijkstra’s Shortest-Path Algorithm
CSS 432: Routing
22
Dijkstra’s Shortest-Path Algorithm
CSS 432: Routing
23
Dijkstra’s Shortest-Path Algorithm
CSS 432: Routing
24
Dijkstra’s Shortest-Path Algorithm
CSS 432: Routing
25
Dijkstra’s Shortest-Path Algorithm
CSS 432: Routing
26
Dijkstra’s Shortest-Path Algorithm
CSS 432: Routing
27
Dijkstra’s Shortest-Path Algorithm
CSS 432: Routing
28
OSPF Open Shortest Path first
Protocol

OSPF (Protocol uses link state routing)





Authenticate information exchanged
Hierarchy: divide domains into areas
Load Balancing: Multiple routers to same destination same cost
to distribute load
5 types of messages
OSPF needs to provide information about how to reach
networks



A router running OSPF generates the following Link State
advertisements LSA:
Advertisements about networks directly connected to router
Cost of the link to another router
CSS 432: Routing
29
Open Shortest Path First Protocol (OSPF)
frame header
Version
Type(=4)
datagram header
OSPF header
Message Length
SourceAddr
AreaId
Checksum
Authentication type
Authentication 0-3
Authentication 4-7


OSPF Message
# of link status advertisements
Options
LS Age
Type=1
Link-state ID
Advertising router
LS sequence number
Link Checksum
Length
Header
0 Flag
0
# of links
1.
Hello (reachability) (Type=1)
2.
Database description (topology) (Type=2)
Link ID
3.
Link status request (Type=3)
Link data
4.
Link status update (Type=4)
5.
Link status acknowledgment (Type=5)
Metric
Link type Num TOS
Advertisement (header type=4)

LS Age: = TTL
Optional TOS information

Type=1: link cost b/w routers

Link-State ID = Advertising Router

Seq # from the same router

Link ID = the other end route ID of link

Link data = used if there are two or more links to the same router

Metric = link cost

Link type = P2P, ethernet, etc

TOS = delay-sensitive, etc
CSS 432: Routing
30
OSPF Con’td


Gated daemon: directly uses IP datagram.
Header Type2: Database description (topology)
message
 Used when the current
 Sent from an initialized
topology has changed.
router to another router which
has a topology information

LS Sequence number
 Used
to determine which message is the latest
 Send a message with a new sequence number and
metric= ∞ when a router or a link fails.
CSS 432: Routing
31
Metrics

Cost of Links?



All links cost 1 (shortest path = lowest number of hops)
Does not consider latency, bandwidth, current traffic
Original ARPANET metric


measures number of packets queued waiting to be transmitted
on each link
took neither latency or bandwidth into consideration


Moves packets towards the shortest queue than to destination
Artificial measure of load
CSS 432: Routing
32
Metrics

New ARPANET metric






stamp each incoming packet at queue with its arrival time (AT)
record departure time (DT) from router
when link-level ACK arrives, compute
Delay = (DT - AT) + Transmit + Latency
if timeout, reset DT to departure time for retransmission
link cost = average delay over some time period
Fine Tuning (metric should vary smoothly with time, not
with very high variation)


compressed dynamic range (range at which the metric can
fluctuate)
replaced Delay with link utilization
CSS 432: Routing
33
VPN





‘Virtual’ Private Network
Actually not a private network but virtually private
Public network made virtually private
IP tunneling
Create a tunnel such that hosts have limited connectivity

Routers are at the beginning and end of the tunnel
 At the beginning of the tunnel encapsulate the IP datagram into another IP
datagram with destination address of the end router
 Once the packet reaches the end router, it extracts the original packet from the
payload and send it to the destination
CSS 432: Routing
34
Virtual Private Networks and Tunnels
Application
Level
A
10.0.0.1
20.0.0.1
Router
Dest router
Source router
Router
Level
A
10.0.0.1
20.0.0.1
To: 20.0.0.1
To: 215.0.0.1
To: 10.0.0.2
215.0.0.1
Company
Branch
Company
Branch
To: 20.0.0.1
A
10.0.0.1
B
To: 20.0.0.1
C
Physical
Network Level
B
To: 215.0.0.1
To: 215.0.0.1
Internet
To: 215.0.0.1
CSS 432: Routing
To: 20.0.0.1
B
20.0.0.1
35
Why VPN?
1.
Security

2.
Routers

3.
Routers with special features such as multicasting
can form a virtual network.
Carry No-IP packets

4.
The final destination/contents of packet cannot be
easily intercepted.
Packets may be non-IP compatible packets.
Mobile IPs

The final destination may be a mobile computer.
CSS 432: Routing
36
NAT
Network Address Translation
1.




Reduce the distribution of IP address
All hosts need not have a globally unique IP address
Hosts need to have a unique address within the private network.
Hosts of Private Network have unique addresses within the
network









If hosts need to communicate they go though the NAT box
(implemented on the router, etc)
The NAT box translates the private IP into IP address of the device
The device implementing NAT is given 1/more globally unique IP
While sending data to the internet, the senders address will be
masqueraded as the global IP assigned
The hosts outside the private network can send data only to the
global IP
The NAT box then sends the data to the respective receiver
Host from the internet, outside the private network cannot
communicate (initiate communication) with the hosts inside the
private network
Hosts inside the private network can initiate communication with
hosts in the internet
2 hosts inside the private network can communicate with the internet
using the same global address. They will use different ports in the 37
NAT device
Mobile IP


Sending host
Sending host, Home Agent, Mobile Host belong to the
same private network
How Sending host can send data to the Mobile agent?
 How does the home agent intercept a packet that is
destined for the mobile agent? --- Use ARP
 How does the home agent then deliver the packet to the
mobile host? – Use DHCP and VPN
10.0.0.3
Home
agent
Internet
DHCP
server
12.0.0.6
Mobile Host
10.0.0.9
(12.0.0.7)
Mobile Host
CSS 432: Routing
38
Mobile IP (Cont’d)
Sending host
1. ARP request: What’s the physical addr
corresponding to 10.0.0.9?
3. Packet request: sends a packet destined for 10.0.0.9
to the home agent’s MAC address
2. ARP response: sends back MAC of
10.0.0.3 instead of 10.0.0.9
1. DHCP: receives a new IP
in the foreign network.
10.0.0.3
Home
agent
Internet
DHCP
server
12.0.0.6
IP tunneling: wraps the packet inside an IP
header destined for the mobile host (12.0.0.7).
Mobile Host
10.0.0.9
(12.0.0.7)
Mobile Host
2. Care-of-address: a mobile host informs its
Home agent of its original and new IPs.
CSS 432: Routing
39

Reviews
 RIP:
distance vector, routing loop and breaking heuristics
 OSPF: link state, Dijkstra’s shortest path algorithm
 VPN and mobile IP

Exercises in Chapter 3
 Ex.
46 (RIP)
CSS 432: Routing
40