Mod3 Routing2
Mod3 Routing2
2
Computer Netwroks, GECT-Ali M A
Routing
Forwarding : take packet >> read destination
address >> consult forwarding table >> and send the
packet in a direction determined by the table.
3
Computer Netwroks, GECT-Ali M A
Network as a Graph
Routing is, in essence, a problem of graph theory
The nodes of the graph, labeled A through F, may be either hosts,
switches, routers, or networks
The edges of the graph correspond to the network links. Each edge
has an associated cost, which gives some indication of the desirability
of sending traffic over that link
Routing is to find the lowest-cost path between any two nodes,
cost of a path equals the sum of the costs of all the edges that make up the path
graph representing a
network
4
Computer Netwroks, GECT-Ali M A
Network Performance Metrics
Metrics
• Property of a route in computer networking,
• Any value used by a routing protocol to select one route over
another.
• For example, Routing Information Protocol (RIP) uses hop count
to determine the best possible route.
Cost Next
B
C
A
D Hop
E B 1 B
F G C 1 C
• With this D ∞ -
information, routing E 1 E
table at A is --> F 1 F
Evolution of the table.
Final Routing table at A
• Each node sends a message to
neighbors with a list of distances.
Cost Next
• F --> A with G is at a distance 1 Hop
• C --> A with D at distance 1.
B 1 B
C 1 C
B D 2 C
E 1 E
C
A
D
E F 1 F
F G G 2 F
Evolution of the table.
Final Routing table at B
Cost Next
B
Hop
C
A 1 A
A
D
E
C 1 C
D 2 C
F G
E 2 A
F 2 A
G 3 C
Evolution of the table.
Final Routing table at G
Cost Next
B
Hop
C
A 2 F
A
D
E
B 3 D
C 2 D
F G
D 1 D
E 3 F
F 1 F
Final Distance Matrix
B A B C D E F G
C
A
A 0 1 1 2 1 1 2
D
B 1 0 1 2 2 2 3
F G
C 1 1 0 1 2 2 2
D 2 2 1 0 3 2 1
E 1 2 2 3 0 2 3
F 1 2 2 2 2 0 1
G 2 3 2 1 3 1 0
Note:
1 1 2 1
A B C
Dest Dist Port Dest Dist Port Dest Dist Port
B 1 1 A 1 1 A 2 1
C 2 1 C 1 2 B 1 1
1 1 2 1
A B X C
Dest Dist Port Dest Dist Port Dest Dist Port
B 1 1 A 1 1 A 2 1
C 2 1 C 1 2 B 1 1
1 1 2 1
A B X C
Dest Dist Port Dest Dist Port
B 1 1 A 1 1
C 2 1 C ? ?
1 1 2 1
A B X C
Dest Dist Port Dest Dist Port
B 1 1 A 1 1
C 2 1 C 3 1
1 1 2 1
A B X C
Dest Dist Port Dest Dist Port
B 1 1 A 1 1
C 2 1 C 3 1
1 1 2 1
A B C
Dest Dist Port Dest Dist Port Dest Dist Port
B 1 1 A 1 1 A 2 1
C 2 1 C 1 2 B 1 1
1 1 2 1
A B X C
Dest Dist Port Dest Dist Port
B 1 1 A 1 1
C 2 1 C 3 1
A B C 5
2 1 2
G
2 4
1
D E F
A B C D E F G
B 6 A 6 B 6 A 2 B 1 C 2 C 5
D 2 C 2 F 2 E 2 D 2 E 4 F 1
E 1 G 5 F
Computer Netwroks, GECT-Ali M A 4 G 1
Dijkstra’s LSR Algorithm
6 2
A B C 5
2 1 2
6 G
A B 2 4
D E F 1
2 1 2
6 G
A B 2 4
D E F 1
2 D
6 2 1 2
6 G
A B 2 4
D E F 1
2
2 D E
2
2 D E
2 1 2 G
5 2 4
6 D E F 1
A B
2 1
2 4
2 D E F
4 8
5 7
6 2
A B c
2 1
2 4
2 D E F
4 8
2 1 2 G
2 4
5 7 D E F 1
6 2
A B c
5
12
2 1 2
G
2 4
2 D E F
4 8
5 7
6 2
A B c
5
12
2 1 2
G
2 4
2 D E F
4 8
5 7
6 2
A B c
5
9
2 1 2
G
1
2 4
2 D E F
4 8
9 B D 5
2 1 2
G C D 7
D D 2
1
2 E D 4
2 D 4
E F F D 8
4 8 G D 9
6 2
A B C 5
2 1 2
G
2 4
D E F 1
A B C D E F G
B 6 A 6 B 6 A 2 B 1 C 2 C 5
D 2 C 2 F 2 E 2 D 2 E 4 F 1
E 1 G 5 F
Computer Netwroks, GECT-Ali M A 4 G 1
Dijkstra’s LSR Algorithm
• Now, if we want to generate a PATH for C:
– First, we add (C,0,0) to PATH
C (0)
C (0)
C (0)
(3) (6)
G
E
C (0)
(3) (6)
G
E
C (0)
(2) (2)
F B
C (0)
(2) (2)
F B
C (0)
(2) (2)
F B
(5)
D
C (0)
(2) (2)
F B
(5)
D
C (0)
(2) (2)
F B
(5)
D
(7)
AA
Computer Netwroks, GECT-Ali M
Dijkstra’s LSR Algorithm
• Place A in PATH (shown as solid line)
– All A’s LSP elements already exist in PATH
C (0)
(2) (2)
F B
(3) (3)
G
E
(5)
D
(7)
AA
Computer Netwroks, GECT-Ali M
Dijkstra’s LSR Algorithm
• We are done since all routes from TENT were
placed into PATH
C (0)
(2) (2)
F B
(3) (3)
G
E
(5)
D
(7)
AA
Computer Netwroks, GECT-Ali M
Dijkstra’s LSR Algorithm
• We can now create a forwarding database:
Forwarding Database
C (0) Destination Port
(2) (2) C C
F B
F F
(3) (3)
G
E G F
B B
(5) E B
D
D B
(7)
A
Computer Netwroks, GECT-Ali M A
A B
Dijkstra Example
* *
1
10
2 3 9
0 4 6
7
5
* *
1
10 inf
10
2 3 9
0 4 6
7
5
inf
5
2
1
10 inf
10
2 3 9
0 4 6
7
5
inf
5
2 Cost updates of 8,14, and 7
1
8 14
2 3 9
0 4 6
7
5
5 7
2 Cost updates of 13
1
8 13
2 3 9
0 4 6
7
5
5 7
2 Cost updates of 9
1
8 9
2 3 9
0 4 6
7
5
5 7
2
1
8 9
2 3 9
0 4 6
7
5
5 7
2