Download - Ccnet Lec 11 Routing
-
8/6/2019 Ccnet Lec 11 Routing
1/42
Lecture
11Data Communication & Networks
Routing and Forwarding
Muhammad Yousaf
-
8/6/2019 Ccnet Lec 11 Routing
2/42
Routing & Forwarding:
Routing and Forwarding are two different butcomplementary functions
Routing:To acquire topology information of the network
Who is situated where?What is the cost to reach a node?
A complex learning problem
Forwarding:
Already know all information about network topologyWhen a packet is received, then select appropriateoutbound network interface for forwarding the packet
Simply a switching problem
-
8/6/2019 Ccnet Lec 11 Routing
3/42
Routing Table @ my system:
C:\Documents and Settings\yousaf>route print
==================================================================
Interface List
0x1 ........................ MS TCP Loopback interface
0x2 ...00 16 d3 03 0a d4 .. Realtek RTL8139/810x Family Fast Ethernet NIC
0x3 ...00 16 6f 52 f3 8b ..... Intel(R) PRO/Wireless 2200BG Network Connection
==================================================================Active Routes:
Network Destination Netmask Gateway Interface Metric
127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1
255.255.255.255 255.255.255.255 255.255.255.255 2 1
255.255.255.255 255.255.255.255 255.255.255.255 3 1
==================================================================
Persistent Routes:
None
-
8/6/2019 Ccnet Lec 11 Routing
4/42
Forwarding:
Every node (Hosts and routers) maintain aforwarding tableForwarding table maps network address to theoutbound network interfaceMost often there is an entry for Default route too!
Packets with destination address that couldnt match withentries of forwarding table, are forwarded to this defaultroute
For end-systems this table is static and simple
For routers however, this table is dynamicComplex protocols are used to form these tables
-
8/6/2019 Ccnet Lec 11 Routing
5/42
Forwarding example:
dest: 18.26.10.3 mask with 255.0.0.0 matched! send to interface 1
dest: 128.16.14.10 mask with 255.0.0.0 not matched
mask with 255.255.0.0 not matched
mask with 0.0.0.0 matched! send to interface 3
Forwarding Process:
Network # Netmask interface
======== ========= ========
18.0.0.0 255.0.0.0 1
128.32.0.0 255.255.0.0 2
0.0.0.0 0.0.0.0 3
Forwarding Table for a router with three interfaces:
-
8/6/2019 Ccnet Lec 11 Routing
6/42
Masking:
Netmask indicates the number of bits for network partNetmask is bitwise ANDed with destination address ofreceived packet
e.g. for netmask 255.0.0.0
& destination address 18.26.10.311111111.00000000.00000000.00000000
00010010.00011010.00001010.00000011 (AND)
================================
00010010.00000000.00000000.00000000
In decimal notation = 18.0.0.0
It is compared with the entry in forwarding table
-
8/6/2019 Ccnet Lec 11 Routing
7/42
Routing:
?
?
?
??
?
?
?
?
?
B
C
D
E
-
8/6/2019 Ccnet Lec 11 Routing
8/42
Routing schemes:
There are number of schemes to help routers inmaking routing decisions
Flooding
Random routing
Source routingDirectory-Base routing
Static routing
Dynamic routing
-
8/6/2019 Ccnet Lec 11 Routing
9/42
Flooding:
Packet received on one interface is broadcasted onall other network interfaces
Network is flooded with a single message
If there is even a single possible path then it isguaranteed that message will reach the destination
Destination can receive multiple redundant copies
First copy will reach with minimum possible delay
Overhead is high
-
8/6/2019 Ccnet Lec 11 Routing
10/42
Flooding: cont
A
B
C
D
E
-
8/6/2019 Ccnet Lec 11 Routing
11/42
Random routing:
Trying to reduce overhead of floodingDo not forward packet on all interfaces
Rather, randomly choose a subset of interfaces andforward only over them
Reduces flooding overhead
It is not guaranteed that packets will either reachthe destination or not
Even if reached, then delays are likely to be high
-
8/6/2019 Ccnet Lec 11 Routing
12/42
Random routing: cont...
A
B
C
D
E
-
8/6/2019 Ccnet Lec 11 Routing
13/42
Source routing:
Source node attaches the path to be followed in theheader of packet
Each router reads the header and sees where toforward the packet
Routing-overhead is smallHeader-to-Packet ratio is large
Cant accommodate dynamics of network
Most users dont know the path to be followed bypackets, so they cant give source route
Source routing can be used for QoS or securerouting of packets
-
8/6/2019 Ccnet Lec 11 Routing
14/42
Source routing: cont
A
B
C
D
E
R1-R4-R6-R11-R12-D
R4-R6-R11-R12-D
R6-R11-R12-D R11-R12-D
R12-D
DR1
R2
R3
R4 R6
R8
R9R10
R11
R12
-
8/6/2019 Ccnet Lec 11 Routing
15/42
Directory-Based routing
Lets migrate the intelligence into the routersEach router maintains a table, that helps to makethe routing decision
Routers can have:
Either static tables
Or dynamic tables
-
8/6/2019 Ccnet Lec 11 Routing
16/42
Static routing tables:
At the time of configuring network devices, tablesare established in each router
Entries are static, can not be updated automatically
Addition or removal of routers/nodes is not easy
Require manual updating of each router
-
8/6/2019 Ccnet Lec 11 Routing
17/42
Dynamic routing tables:
Again each node maintain a routing tableBut this time, table is not fix or constant
It can change automatically to accommodate thenetwork changes
Sophisticated routing protocols are designed fordynamically updating these tables
All nodes exchange routing advertisements with
each other periodicallyHence nodes remain aware of the networkdynamics
-
8/6/2019 Ccnet Lec 11 Routing
18/42
Routing Protocols:
Most of the modern protocols are dynamicThey can adapt to the current condition of thenetwork
Well known strategies for adaptive routing are:
Distance Vector routing
Link State routing
These protocols define procedures following which,
routers can acquire information in theirrouting/forwarding tables
-
8/6/2019 Ccnet Lec 11 Routing
19/42
Routing Protocols: cont.
Distance VectorCommunicate information to neighbors only
Exchange information about entire network
Link State
Communicate information to entire network
Exchange information about neighbors only
State of own links is exchanged
-
8/6/2019 Ccnet Lec 11 Routing
20/42
Distance Vector routing:
Distributed Bellman-Ford routing algorithmAlso known as Ford-Fulkerson algorithm
Original ARPANET routing protocol
Used in Internet as RIP
RIP = Routing Information Protocol
First dynamic routing protocol
Automatically compute routing tables
Freeing administrators from statically specifying routes
-
8/6/2019 Ccnet Lec 11 Routing
21/42
Distance Vector routing: cont
Each router maintains a distance vector:Containing one entry for each router in the network
Each entry also contains the distance (cost) and the nexthop to reach that destination
So, each entry is a set of triplet (Destination, Cost, NextHop)Cost = number of hops, time delay, etc
It is assumed that routers know the distance to each of its neighbors
Routing updates are exchanged with directly
connected neighbors by:periodically (from time period of milliseconds to minutes)triggered update (whenever significant change occurs)
-
8/6/2019 Ccnet Lec 11 Routing
22/42
Calculating Cost:
Let cost to reach from me to my neighbor is 1If my neighbor tells me that he can reach the routerD in cost 3
Then I can conclude that the cost to reach from me
to router D is 1+3=4
-
8/6/2019 Ccnet Lec 11 Routing
23/42
Calculating Cost: example
A
B
C
D
E
R1
R2
R3
R4 R6
R8
R9R10
R11
R12R3=(R12, 3, R8)R1=(R12, 4, R3)
-
8/6/2019 Ccnet Lec 11 Routing
24/42
6 2
2 5
1 1 1
source
Destination
A
C E
infinity infinityB
infinity
infinityinfinity
infinity infinity 1 Dest
5 Destinfinity
1 Dest3 Binfinity
5 Dest7 E
1 Dest3 B8 C
4 A7 E
8 C 3 B 1 Dest
4 A6 E
Distance Vector Iterations:
-
8/6/2019 Ccnet Lec 11 Routing
25/42
Distance Vector Iterations: example
Information in routing table of each node:Iteration 1
D
G
A
F
E
B
C
At distance to reach node
node A B C D E F G
A 0 1 1 x 1 1 xB 1 0 1 x x x x
C 1 1 0 1 x x x
D x x 1 0 x x 1
E 1 x x x 0 x xF 1 x x x x 0 1
G x x x 1 x 1 0
-
8/6/2019 Ccnet Lec 11 Routing
26/42
Distance Vector Iterations: example
Information in routing table of each node:Iteration 2
D
G
A
F
E
B
C
At distance to reach node
node A B C D E F G
A 0 1 1 2 1 1 2B 1 0 1 2 2 2 x
C 1 1 0 1 2 2 2
D 2 2 1 0 x 2 1
E 1 2 2 x 0 2 xF 1 2 2 2 2 0 1
G 2 x 2 1 x 1 0
-
8/6/2019 Ccnet Lec 11 Routing
27/42
Distance Vector Iterations: example
Information in routing table of each node:Iteration 3
D
G
A
F
E
B
C
At distance to reach node
node A B C D E F G
A 0 1 1 2 1 1 2B 1 0 1 2 2 2 3
C 1 1 0 1 2 2 2
D 2 2 1 0 3 2 1
E 1 2 2 3 0 2 3F 1 2 2 2 2 0 1
G 2 3 2 1 3 1 0
-
8/6/2019 Ccnet Lec 11 Routing
28/42
Distance Vector Routing Table:
Routing table at node B:
D
G
A
F
E
B
C
Destination Cost NextHop
A 1 A
C 1 C
D 2 C
E 2 A
F 2 A
G 3 A
-
8/6/2019 Ccnet Lec 11 Routing
29/42
Distance Vector: (Link Failure)
F detects that link to G has failedF sets distance to G as infinity andsends update to A
A sets distance to G as infinity since it
was using F to reach GA receives periodic update from C with2-hop path to G
A sets distance to G to 3 and sends
update to FF decides it can reach G in 4 hops viaA
D
G
A
F
E
B
C
-
8/6/2019 Ccnet Lec 11 Routing
30/42
Count to Infinity Problem:
A game of mutual deception
Suppose, link from A to E fails
A advertises distance of infinity to E,
B and C advertise a distance of 2 to E
B decides it can reach E in 3 hops;advertises this to all
A decides it can read E in 4 hops;advertises this to all
C decides that it can reach E in 5 hops
We are counting to infinity
D
G
A
F
E
B
C
-
8/6/2019 Ccnet Lec 11 Routing
31/42
Problems with Distance Vector:
One iteration per hop for new routesInformation propagates slowly
Cant scale well for large network
Count to infinity for lost routes
-
8/6/2019 Ccnet Lec 11 Routing
32/42
Link State Routing:
Send to all nodes (not just neighbors) information ofdirectly connected nodes (links)
Most widely used dynamic routing scheme
Best example is OSPF protocol
OSPF = Open Shortest Path First
Work began in 1980s as a replacement for RIP
Uses Dijkstras algorithm for shortest path calculation
OPEN means, it is freely available open standardWhile IGRP & EIGRP are CISCO proprietary protocols
-
8/6/2019 Ccnet Lec 11 Routing
33/42
OSPF:
OSPF is well supported by:CISCOs Internetwork Operating System (IOS)
Routing & Remote Access Service (RRAS) of MicrosoftWindows 2000 & .NET plateforms
So far, there are three versions:OSPF (RFC-1131), experimental, not widely used
OSPFv2 (RFC-2328), most widely deployed routingprotocol since 1990
OSPFv3, recent development, support for IPv6, withenhanced security
-
8/6/2019 Ccnet Lec 11 Routing
34/42
OSPF: cont
Routers discover its neighbors by Hello messagesHello messages are sent every 10 to 15 secondsThese messages indicate the liveliness of the routersIf hello is not received from some router in specified time,then it is assumed that the router is down
Each router then transmit Link State Advertisement(LSA) messages
LSA contains the information about changes in networktopology
Routers maintains a list of all the LSAs from all therouters and then run Dijkstras algorithm on this list
-
8/6/2019 Ccnet Lec 11 Routing
35/42
OSPF message format:
OSPF operates above the network layerThere are five types of OSPF messages
All OSPF messages include the OSPF header
-
8/6/2019 Ccnet Lec 11 Routing
36/42
OSPF header:
-
8/6/2019 Ccnet Lec 11 Routing
37/42
OSPF header: cont
Version:OSPF version, current version is v2
Type:
Type-1 = Hello message
Type-2 = Database Description message
Type-3 = Link State (LS) request message
Type-4 = LS update message
Type-5 = LS Acknowledgement message
Packet Length:
Length of entire packet, including header
-
8/6/2019 Ccnet Lec 11 Routing
38/42
OSPF header: cont
Router ID:ID of the message generating router
Area ID:
Area ID of network on which this packet is being sent
Checksum:Checksum of entire packet, including header
-
8/6/2019 Ccnet Lec 11 Routing
39/42
OSPF header: cont
Au Type:Authentication Type
0 = no authentication
1 = password authentication
2 = MD5 checksum
Authentication Data:
Data that is to be used for authentication
-
8/6/2019 Ccnet Lec 11 Routing
40/42
Dijkstras Algorithm:
Calculates the shortest path between nodes
Relies on the information received in LSAs
For calculation each router maintains two lists:Tentative list
Confirmed listHow algorithm works:
Initialize confirmed list & tentative list with your own entry
Pick the entry of shortest cost from tentative list
Include that entry in confirmed listInclude LSA of most recently picked entry in tentative list
Repeat procedure until tentative list is empty
-
8/6/2019 Ccnet Lec 11 Routing
41/42
Dijkstras Algorithm: (example)
At node D:
Confirmed list Tentative list
1. (D,0,-)
2. (D,0,-) (C,2,C), (B,11,B)
3. (D,0,-), (C,2,C) (B,11,B)
4. (D,0,-), (C,2,C) (B,5,C), (A,12,C)5. (D,0,-), (C,2,C), (B,5,C) (A,12,C)
6. (D,0,-), (C,2,C), (B,5,C) (A,10,C)
7. (D,0,-), (C,2,C), (B,5,C), (A,10,C)
D
A
B
C
5 3
2
11
10
-
8/6/2019 Ccnet Lec 11 Routing
42/42
To be continued