Understanding Routing Protocols and Tables
Understanding Routing Protocols and Tables
routing protocol
- the process of preparing the routing table and finding the best path(shortest) is known as routing .
- routing is optional.
r2 r5 r10
A r1 r3 r6 r9 B
r4 r7 r8
r2 r5 r10
r4 r7 r8
routing table
concept: flooding
flooding is simple computer network routing algorithm in which every incoming packet is sent
through every outgoing link except one it arrived on.
advantage of flooding:
- no need to prepare routing table at every router.
- no routing is required.
- shortest path is always guarantee i.e. the packet arrives at the destination first(destination ke pass packet
sabse pehle jo pahunchega will be the shortest path)
- it is highly reliable, if one path is down then the packet reach at the destination by choosing another path.
disadvantage of flooding:
- traffic is very high, traffic bhaut jada hoga network ke upar
- many duplicate packets received by receiver.
advantage of routing:
- traffic is very less.
- no duplicate packet received by receiver.
disadvantage of routing:
Chapter - 8 (Routing protocol) Page 2
disadvantage of routing:
- routing table is required (time consuming, prepare routing table at every router)
- chosen path may be down so it is not highly reliable.
- shortest path is depends on the algorithm and some algorithms fails to find the shortest path.
- cannot travel from other path as shortest path will be fixed with the help of routing table
routing table:
routing algorithm
(i) static : path is fixed and cannot be changed
(ii) dynamic
- distance vector routing
- link state routing
routing table:
step (i) prepare the routing table at every router based on the local knowledge
7
1 3
A B
2
(a) from A (b) from B
- at A
A receive distance vector from B, D
- at B
B receive distance vector from A, C, D
- at C
C receive distance vector from B, D
- at D
D receive distance from A, B, C
- at A
A receive distance vector from B, D
A will update its routing table according to B and D.
from-B from-D
B D
A 2 A 1
B 0 B 7
C 3 C 11
D 7 D 0
how to compute?
- either take help from B or D.
(a) A to B
2 0
- A to B(2)+ B to B(0) A B+B B
(b) A to D
1 7
- A to D(1)+ D to B(7) A D+ D B
min {2,8} = 2
next hop will be B.
for A to C
(a) A to C
2 3
- A to B(2)+ B to C(3) A B+B C
(b) A to D
1 11
- A to D(0)+ D to C(11) A D+ D C
min {5,12} = 5
next hop will be C.
for A to D
(a) A to D
2 7
- A to B(2)+ B to D(7) A B+B D
(b) A to D
1
- A to D(1) A D
min {9,1} = 1
next hop will be D.
AD rule: shortcut
- at A
A receive distance vector from B, D
A will update its routing table according to B and D.
from-B from-D
B D
A 2 A 1
B 0 B 7
C 3 C 11
D 7 D 0
AB=2 AD=1
for A to B
from-B from-D
B D
A 2 A 1
B 0 B 7
C 3 C 11
D 7 D 0
AB=2 AD=1
-2 - 1+7=8
min {2,8}=2
for A to C
from-B from-D
B D
A 2 A 1
B 0 B 7
C 3 C 11
D 7 D 0
AB=2 AD=1
-2 - 1+7=8
- 2+3=5 - 1+11=12
min {5,12}=5
for A to D
from-B from-D
B D
A 2 A 1
B 0 B 7
C 3 C 11
D 7 D 0
AB=2 AD=1
-2 - 1+7=8
- 2+3=5 - 1+11=12
- 2+7=9 - 1+0=1
min {9,1}=1
D 1 D
little analysis:
(i) A received from B
from-B
add A and B
B
A 2
- now calcualte the path
B 0
lets say we are calculating for A to C
C 3
D 7
so, A to B is 2
AB=2
and B to C is 3 - 2+3=5
total : 5
- at B
B receive distance vector from A, C, D
B will update its routing table according to A, C and D.
for B to A
min {2,∞,8}=2
for B to C
for B to D
11
D C
Chapter - 8 (Routing protocol) Page 10
11
D C
7
1 3
A B
2
(a) from A (b) from B
1 1
A B C D
∞ ∞ ∞
1 1 1
A B C D
∞ ∞ ∞
1 1 1
A B C D
∞ ∞ ∞
1 ∞ ∞
1 1 1
A B C D
∞ ∞ ∞
1 ∞ ∞ (time t1)
1 ∞ ∞
- C ask D to reach A, D shares the infomation with C: cost is ' ∞' to reach A
1 1 1
A B C D
∞ ∞ ∞
1 ∞ ∞ (time t1)
1 2 ∞
1 1 1
A B C D
∞ ∞ ∞
1 ∞ ∞ (time t1)
1 2 ∞
1 1 1
A B C D
∞ ∞ ∞
1 ∞ ∞ (time t1)
1 2 3 (time t2)
now, even if you continue to run the algorithm the values remains the same.
1 1 1
A B C D
1 2 3
1 1
A B C D
1 2 3
1 1
A B C D
1 2 3
Chapter - 8 (Routing protocol) Page 14
1 2 3
∞ 2 3
1 1
A B C D
1 2 3
∞ 2 3
3 2 3 (time t1)
1 1
A B C D
1 2 3
∞ 2 3
3 4 3 (time t1)
1 2 3
∞ 2 3
3 4 3 (time t1)
5 4 3 (time t2)
1 1
A B C D
1 2 3
∞ 2 3
3 4 3 (time t1)
5 4 5 (time t2)
- why it happened?
B sends the packet to C, C wants to send the packet to A then it will send to D
because the path for A from C is by D to A
D wants to sends the packet to A, D will send the packet to C because the path for
A from D is by C to A
we only share distance vector and not the whole table, if we would have shared the
whole table then it would have avoided infinite looping
if we share routing table then the router will get to know the paths
- at D
'D' received its distance vector from c
from C
2
DC=1
- 2+1=3
point to remember:
- solution of count to infinity problem is given by split horizon
(ii) if a node is dependent on some other node to reach the destination then it cannot help.
- direct cost mat bejho, pehle check karo apni table ko what is your next hop?
B asks C to reach A, C depend on B (next hop), C cannot help B.
because, C itself depends on B
∞ 2 3
i cannot help ∞
(iii) if a node is dependent on some other node to reach the destination then it cannot help.
- direct cost mat bejho, pehle check karo apni table ko what is your next hop?
C asks D to reach A, D depend on C (next hop), D cannot help C.
because, D itself depends on C
∞ ∞ 3
i cannot help ∞
i cannot help ∞
∞ ∞ 3
i cannot help ∞
i cannot help ∞
∞ ∞ ∞
continues to ∞ unreachable.
- after 4,5 steps algorithms stops.
question:
∞ routing table of B:
0
destination distance next hop
∞ A B
9 A 2 A
B 0 B
2 C 5 A
0 D 9 D
C D
5
∞
what distance vector router 'B' will share to 'A' and 'D' by using split horizon concept?
(a) depends on A: ∞(share to A)
destination distance next hop
A 2 A B depends on A: ∞
B 0 B B depends on B: 0
C 5 A B depends on A: ∞
D 9 D B depends on D: 9
(d) from D
(c) from C
D
seqno. C
A 1 seqno.
Chapter - 8 (Routing protocol) Page 21
(c) from C
D
seqno. C
A 1 seqno.
B 7 B 3
C 11 D 11
11
D C
7
1 3
A B
2
step (ii) every router flood the link state packet to every other router.
- at A
A received link state packet from B, C, D
2
A B
(b) A get to know that node to 'C' is present in the graph from B: 3
2
A B
(c) A get to know that node to 'D' is present in the graph from B: 7
2
A B
7
3
D C
(d) A get to know that node to 'D' is present in the graph from C: 11
2
A B
7
3
D C
11
(e) A get to know that node to 'D' is present in the graph from D: 1
2
A B
1 7
3
D C
11
- at B
B received link state packet from A, C, D
- dijkstra algorithm:
- at C
C received link state packet from A, B, D
- dijkstra algorithm:
Chapter - 8 (Routing protocol) Page 24
- dijkstra algorithm:
(i) the fundamental idea is to use flooding to distribute the link state packets to all routers. to
keep the flood in check, each packet contains a sequence number that is incremented for each new
packet sent.
(ii) routers keep track of all the (source router sequence) pairs they see.
(iii) when a new link state packet comes in, it is checked against the list of packets already seen.
if it is new, it is forwarded on all lines except the one it arrived on.
(v) if a packet with a sequence number lower than the highest one seen so far ever arrives, it is
rejected as being obsolete as the router has more recent data.
(i) if the sequence numbers wrap around i.e we have reached the maximum sequence number and
next will be 0, confusion will come.
solution: use a 32-bit sequence number. with one link state packet per second, it would take
137 years to wrap around, so this possibility can be ignored.
A B C
D
Chapter - 8 (Routing protocol) Page 25
D
(i) if A want to send the packet, A forwards the packet to B, B forward the packet to every outer going
link except the one it came from (A)
rec(a)
A B C
D
rec(b)
(ii) if C want to send the packet received from B, C forward the packet to every outer going link except
the one it came from (B)
rec(a) rec(b)
A B C
D
rec(b)
rec(c)
(iii) if D want to send the packet received from B, D forward the packet to every outer going link except
the one it came from (B)
rec(d)
rec(a) rec(b)
A B C
D
rec(b)
rec(c)
(iv) if C want to send the packet received from D, C forward the packet to every outer going link except
the one it came from (D)
rec(c) rec(d)
rec(a) rec(b)
A B C
D
rec(b)
rec(c)
(v) if D want to send the packet received from C, D forward the packet to every outer going link except
the one it came from (C)
rec(d)
rec(c) rec(d)
rec(a) rec(b)
A B C
D
rec(b)
rec(c)
(vi) if B want to send the packet received from C, B forward the packet to every outer going link except
the one it came from (C)
rec(d)
rec(c) rec(d)
rec(b) rec(a) rec(b)
A B C
D
rec(b)
rec(c)
rec(b)
infinite looping.
A B C
A 0 A 0
rec(a) rec(b)
A B C
A 0 A 0
rec(a) rec(b)
A B C
D
rec(b)
A 0
(iii) if D want to send the packet received from B, D forward the packet along with sequence number to
every outer going link except the one it came from (B)
A 0 A 0 A 0
rec(a) rec(b) rec(d)
A B C
D
rec(b)
A 0
(iv) if C want to send the packet received from B, C forward the packet along with sequence number to
every outer going link except the one it came from (B)
A 0 A 0 A 0
rec(a) rec(b) rec(d)
A B C
D
rec(b) rec(c)
A 0 A 0
it checks
- have i forwaded the same packet before?
if yes, then it will discard the packet.
so it basically discard the lower and same sequeunce number packets and only
forwards the higher sequence number packets.
(ii) if a router ever crashes, it will lose track of its sequence number. if it starts again at 0, the
next packet it sends will be rejected as a duplicate.
(iii) if a sequence number is ever corrupted and 65,540 is received instead of 4 (a 1-bit error),
packets 5 through 65,540 will be rejected as obsolete, since the current sequence number will be
thought to be 65,540
solution:
include the age of each packet after the sequence number and decrement it once a second. when the
age hits zero, the information from that router is discarded. normally, a new packet comes
in, say, every 10 sec, so router information only times out when a router is down (or six
consecutive packets have been lost, an unlikely event). The Age field is also decremented by each
router during the initial flooding process, to make sure no packet can get lost and live for an
indefinite period of time (a packet with age zero is discarded).
u15: 00...0000011111
so from 16 to 47 every packet are rejected but they were valid packets.
solution:
add one more thing in the table- lifetime/validity/age
at D database:
router latest seq no lifetime/validity/age
A 47 10 seconds
B 20
C 30
entry permanent nahi hoti (47) uski ek age hoti hai lets say 10second
- 10second ke baad yeh entry delete ho jayegi aur jo latest sequence number hai uski
entry hoti rahegi.
- so it will not cause such a blunder of rejecting large number of valid packets.
rip: routing information protocol is a dynamic routing protocol which uses hop count as a routing
metric to find the shortest path between source and destination.
- the path with the lowest hop count is considered as the best path from source to destination.
- rip prevents infinite looping by limiting the number of hops allowed in a path from source to
destination.
- the maximum hop count allowed for rip is 15, and a hop count of 16 is considered as destination
unreachable.
point to remember:
rip uses udp as its transport protocol with the port number 520.
1 1
A B C D
Chapter - 8 (Routing protocol) Page 32
1 1
A B C D
1 2 3
∞ 2 3
3 4 3
. . .
. . .
15∞ 15∞ 15∞