7 Module 5 03 Apr 2021material I 03 Apr 2021 Routing

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 40

Routing

• Hop
• The packet passes through a router
• The next hop
• the destination address of the next gateway
• A router doesn't need to know how to get everywhere
• It just needs to know how to get out of here
• A default route handles everything not specifically listed
• TTL in IPV4, hop limit in IPV^
• Avoid packet looping forever
• Every router needs to know where traffic should be dent.
• A router with the incorrect next hop will result in a routing problem
• Data will go wrong direction
Routing table
• Directions for the packets that is send.
• A table with routes to your destination.
• Packets stop at every router and ask for directions.
• The actual forwarding of IP packets by routers is called IP routing
Above we have two host computers and two routers. H1 is going to send an IP packet to
H2 which has to be routed by R1 and R2.
• IP Routing process
• Host (H1)
• This host creates an IP packet with its own IP address (192.168.1.1) as
the source and H2 (192.168.2.2) as the destination
• The first question from the H1 host is, Whether the destination is local or
remote?
• We need to know the mask,
Subnet Mask . . . . . . . . . . . : 255.255.255.0
• What is the network id, 192.168.1.0 so all IP addresses in the 192.168.1.1 –
254 range are local.
• Our destination (192.168.2.2) is outside of the local subnet so that
means we have to use the default gateway.
• do I know the destination MAC address of the default gateway?
• It checks its ARP table to find the answer, sends an arp request
Internet Address Physical Address
192.168.1.254 fa-16-3e-3f-fd-3c
• H1 will prepare its data,

• The frame will be on its way to R1.


• Router R1,
• The first thing it does, is check if the FCS (Frame Check Sequence) of
the Ethernet frame is correct or not:

• If the FCS is incorrect, the frame is dropped right away.


• If the FCS is correct, we will process the frame if:
• The destination MAC address matches the MAC address of R1’s
GigabitEthernet 0/1 interface so we will process it.
• Takes the IP packet and checks the header checksum, if it is correct
then, it will check the destination address.
• R1 now checks its routing table to see if there is a match:
• How is this routing table constructed for R1
Structure
Routing protocols
• Unicast routing protocol
• Open source shortest path – based on link state
• Routing information protocol – based on the distance vector
Link state routing
• also know as Dijkstra's Algorithm
• It computes the least cost path from one node (source node) to all
other nodes in the network
• its iterative until kth least cost paths are known to k destination nodes
• Apply link state routing and find the shortest path from A to Z?
Distance vector routing
• Distance Vector Routing is a dynamic routing algorithm.
• Follows Bellman ford algorithm
• Each router prepares its routing table (step 1). By their local
knowledge. each router knows about,
• All the routers present in the network
• Distance to its neighboring routers
Router A
Step 1
Destn Dist Nxt
hop
A 0 A
B 2 B
C ∞ –
D 1 D
Router B

Destn Dist Nxt


hop
A 2 A
Router D B 0 B

Destn Dist Nxt C 3 C


hop D 7 D
A 1 A
B 7 B Router C

C 11 C Destn Dist Nxt


D 0 D hop
A ∞ –
B 3 B
C 0 C
D 11 D
• Step - 2
• Each router exchanges its distance vector obtained in Step-1 with its
neighbors.
• After exchanging the distance vectors, each router prepares a new routing
table.
Router A
• Router A receives distance vectors from its neighbors B and D.
• Router A prepares a new routing table as

Old table, Router A New table, Router A


From B From D
Destn Dist Nxt Destn Dist Nxt
hop A 2 1 hop
A 0 A 7 A 0 A
B 0
B 2 B 11 B 2 B
C 3
C ∞ – 0 C ∞ –
D 7
D 1 D D 1 D
• Cost of reaching router B from router A via neighbor B = Cost (A→B) + Cost
(B→B)= 2 + 0
• Cost of reaching router B from router A via neighbor D = Cost (A→D) + Cost
(D→B) = 1 + 7
• min { 2+0 , 1+7 } = 2 via B

Old table, Router A New table, Router A


From B From D
Destn Dist Nxt Destn Dist Nxt
hop A 2 1 hop
A 0 A 7 A 0 A
B 0
B 2 B 11
C 3
C ∞ – 0
D 7
D 1 D
• Cost of reaching router B from router A via neighbor B = Cost (A→B) + Cost
(B→B)= 2 + 0
• Cost of reaching router B from router A via neighbor D = Cost (A→D) + Cost
(D→B) = 1 + 7
• min { 2+0 , 1+7 } = 2 via B

Old table, Router A New table, Router A


From B From D
Destn Dist Nxt Destn Dist Nxt
hop A 2 1 hop
A 0 A 7 A 0 A
B 0
B 2 B 11 B 2 B
C 3
C ∞ – 0
D 7
D 1 D
• Cost of reaching router C from router A via neighbor B = Cost (A→B) + Cost
(B→C)= 2 + 3
• Cost of reaching router C from router A via neighbor D = Cost (A→D) + Cost
(D→C) = 1 + 11
• min { 2+3 , 1+11 } = 5 via B

Old table, Router A New table, Router A


From B From D
Destn Dist Nxt Destn Dist Nxt
hop A 2 1 hop
A 0 A 7 A 0 A
B 0
B 2 B 11 B 2 B
C 3
C ∞ – 0
D 7
D 1 D
• Cost of reaching router C from router A via neighbor B = Cost (A→B) + Cost
(B→C)= 2 + 3
• Cost of reaching router C from router A via neighbor D = Cost (A→D) + Cost
(D→C) = 1 + 11
• min { 2+3 , 1+11 } = 5 via B

Old table, Router A New table, Router A


From B From D
Destn Dist Nxt Destn Dist Nxt
hop A 2 1 hop
A 0 A 7 A 0 A
B 0
B 2 B 11 B 2 B
C 3
C ∞ – 0 C 5 B
D 7
D 1 D
• Cost of reaching router D from router A via neighbor D = Cost (A→D) + Cost
(D→D)= 1 + 0
• Cost of reaching router D from router A via neighbor B = Cost (A→B) + Cost
(B→D) = 2 + 7
• min {1+0, 2+7 } = 1 via D

Old table, Router A New table, Router A


From B From D
Destn Dist Nxt Destn Dist Nxt
hop A 2 1 hop
A 0 A 7 A 0 A
B 0
B 2 B 11 B 2 B
C 3
C ∞ – 0 C 5 B
D 7
D 1 D D 1 D
Router B

• Router B receives distance vectors from its neighbors A, C and D.


• Router B prepares a new routing table as-

A
B
C
D
New table, Router B
Destn Dist Nxt
Cost of reaching destination A from router B = min { 2+0 , 3+∞ , 7+1 } = 2 via A. hop
Cost of reaching destination C from router B = min { 2+∞ , 3+0 , 7+11 } = 3 via C.
A 2 A
Cost of reaching destination D from router B = min { 2+1 , 3+11 , 7+0 } = 3 via A
B 0 B
C 3 C
D 3 A
New table, Router C
Destn Dist Nxt
hop
A 5 B
B 3 B
C 0 C
D 10 B

New table, Router D


Destn Dist Nxt
hop
A 1 A
B 3 A
C 10 B
D 0 D
• Step – 3
• Each router exchanges its distance vector obtained in Step-2 with its
neighboring routers.
• After exchanging the distance vectors, each router prepares a new routing
table

New table, Router A

Destn Dist Nxt


hop
A 0 A
B 2 B
C 5 B
D 1 D
New table, Router B New table, Router C

Destn Dist Nxt Destn Dist Nxt


hop hop
A 2 A A 5 B
B 0 B B 3 B
C 3 C C 0 C
D 3 A D 6 B

New table, Router D

Destn Dist Nxt


hop
A 1 A
B 3 A
C 6 A
D 0 D
• Identifying Unused Links
• After routing tables converge (becomes stable),
• Some of the links connecting the routers may never be used.
• In the example, we can identify the unused links as,

New table, Router A

Destn Dist Nxt


hop
A 0 A AB and AD are used.
B 2 B
C 5 B
D 1 D
New table, Router B New table, Router C

Destn Dist Nxt Destn Dist Nxt


hop hop
A 2 A A 5 B
BA and BC are used.
B 3 B CB is used
B 0 B
C 3 C C 0 C
D 3 A D 6 B

New table, Router D

Destn Dist Nxt


hop
Thus, edges BD and CD are never used.
A 1 A
B 3 A DA is used.

C 6 A
D 0 D

You might also like