Slides supporting the "Computer Networking: Principles, Protocols and Practice" ebook. The slides can be freely reused to teach an undergraduate computer networking class using the open-source ebook.
Olivier BonaventureProfessor at Université catholique de Louvain (UCL) and co-founder at Tessares
9. Question
• How to combine bit stuffing and
checksums ?
• Apply stuffing first and then compute
checksum on the sender
• Compute checksum and then apply
stuffing
Payload
Header Trailer
10. Agenda
• Reliable transmission
• Checksums
• Framing
• Finite State Machines
• Go-back-n
• Selective repeat
• Building a network
14. Go-back-n : example
A B
0 1 2 3
0 1 2 3
0 1 2 3
0 1 2 3
0 1 2 3
Data.req(e)
Data.req(a)
Data.ind(a)
D(0,a)
Data.req(c)
D(2,c)
C(OK,0)
C(OK,0)
Sending window
Data.req(b)
D(1,b)
Lost
Not expected seq num,
discarded
Retransmission
timer expires
Sending window is full
0 1 2 3
0 1 2 3
D(1,b)
Data.ind(b)
Data.req(d)
D(3,d)
Data.ind(d)
D(2,c)
Data.ind(c)
15. Question
• You implement a go-back-n receiver using 3 bits
to encode the sequence number. You have
correctly received frame 7 and delivered its
content. You now receive a correct frame 0, how
do you react ?
• you ignore the frame and send ACK(7)
• you accept the frame, deliver it and send
ACK(7)
• you accept the frame, deliver it and send
ACK(0)
16. Question
• Go-back-n is used in a network where all
data frames are correctly received, but
every second acknowledgement is
corrupted. How many data frames will be
retransmitted by the sender if it sends 20
data frames ?
17. Question
• Go-back-n is used by a protocol that
encodes sequence numbers using 5 bits.
What is the largest possible sending
window (in frames) ?
18. Question
• Go-back-n is used in a satellite network
with a round-trip-time of 1 sec. What is
the minimum sending window (in frames)
to fully use a 1 Mbps link using 10.000
bits frames ?
21. Question
• You implement a selective repeat receiver using
3 bits to encode the sequence number. You have
correctly received frame 6 and delivered its
content. You receive a correct frame 1, what do
you do ?
• you ignore the frame and send ACK(6)
• you accept the frame, store it in your buffer
and send ACK(6)
• you accept the frame, store it in your buffer
and send ACK(1)
22. Question
• You implement a selective repeat receiver using
3 bits to encode the sequence number. You have
correctly received frame 7 and delivered its
content. You receive a correct frame 3, what do
you do ?
• you ignore the frame and send ACK(7)
• you accept the frame, store it in your buffer
and send ACK(7)
• you accept the frame, store it in your buffer
and send ACK(3)
23. Take back lessons
• Usage of Checksums/CRCs
• Finite State Machines
• Cumulative acknowledgements
• Maximum window size with GBN/SR
• Bandwidth x delay product
24. Piggybacking
Student question
• lorsque l’on utilise le piggybacking, comment est-ce
que l’on détermine que l’on peut envoyer à la fois
l’ACK de ce qu’on a reçu et envoyer la frame avec la
séquence propre à l’hôte qui envoie cet ACK ? Ma
question porte sur le mécanisme inhérent au
piggybacking. Je pense que ça doit être plutôt rare
d’avoir à envoyer le message pile au bon moment
pour faire d’une pierre deux coups et envoyer l'ACK
et la frame. Du coup est-ce qu’il y a un mécanisme
derrière qui attend que l'on ait à envoyer une frame
dans un court laps de temps suivant la réception
d’une frame ou bien est-ce simplement une
concordance des évènements qui fait que l’on
détermine alors qu’on peut envoyer les deux à la fois.
25. How to transfert
information ?
• Divide it in small blocks called packets
which can be sent independently
ABCDEFGHIJKLMNOPQRSTUVWXYZ1234
ABCDEFGHIJKLM
NOPQRSTUVW
XYZ1234
26. Agenda
• Reliable transmission
• Building a network
• Virtual circuit organisation
• Datagram organisation
• Distance vector routing
• Link state routing
27. How to organise a
network ?
Source: wikipedia : https://en.wikipedia.org/wiki/Post_office and https://en.wikipedia.org/wiki/Telephone_exchange
28. Agenda
• Reliable transmission
• Building a network
• Virtual circuit organisation
• Datagram organisation
• Distance vector routing
• Link state routing
29. Virtual circuit
• Basic idea
• Create circuits through the network to
transfer data divided in packets
• Packets contain one (or more) labels
• Simpler forwarding table
• incoming label, nexthop, outgoing
label
33. A network
B
A R1
R2
R3
• Contents of the forwarding table
• Destination, nexthop/outgoing if
A: West
B: East
A: North
B: North-East
A: North
B: South-East
34. A simple solution
Port-station table
• When a node boots, its forwarding table
is empty, is it possible to learn
automatically the forwarding table from
the data packets ?
• Tree-shaped networks only !
35. A simple network
B
A R1
R2
R3
A->B
A: West
A->B A->B
A: North
A->B
A: North-West
B->A
B->A
B->A
36. Source routing
• Basic idea
• Each node has a unique address
• Each node knows its direct neighbours
• How ?
• Each packet contains the list of the
addresses of intermediate nodes
37. Source routing (2)
B
A R1
R2
R3
A: West
R2: South-West
R3: East
R1: North
R2: North-
East
B: South
R1: North-
West
R2: South-
West
A->B via R1,R3
A->B via R1,R3
A->B via R1,R3
B->A via R3,R2,R1
B->A via R3,R2,R1
B->A via R3,R2,R1
38. Can we do better ?
• Networks must be redundant to cope with
failures
• tree-shaped networks are not sufficient
• Source routing consummes header
space
39. Static routing
C
E
A B C
D E
Routing table
A : Local
D : South
B : East
C : East [via B]
E: East [via B]
Routing table
A : West
B : Local
C : East
D : South [via E]
E : South
Routing table
A : West [via B]
B : West
C : Local
D : West [via B]
E : South West
Routing table
A : North
B : North [via A]
C : East [via E]
D : Local
E : East
Routing table
A : North [via B]
B : North
C : North-East
D : West
E : Local
• Manually compute router forwarding
tables
40. Question
C
E
A B C
D E
Routing table
A : Local
D : South
B : East
C : East [via B]
E: East [via B]
Routing table
A : West
B : Local
C : East
D : South [via E]
E : South
Routing table
A : West [via B]
B : West
C : Local
D : West [via B]
E : South West
Routing table
A : North
B : North [via A]
C : East [via E]
D : Local
E : East
Routing table
A : North [via B]
B : North
C : North-East
D : West
E : Local
• Link A-B fails, which tables must be
updated ?
41. Agenda
• Reliable transmission
• Building a network
• Virtual circuit organisation
• Datagram organisation
• Distance vector routing
• Link state routing
42. Distance vector
routing
• Objectives of the routing protocol
• Automatically compute all forwarding
tables so that each node can reach any
node in the network
• Principle
• Each node regularly sends a summary
of its forwarding table to its neighbors
43. Distance vector
C
D E
Routing table
A : 0 [ Local ]
A B C
D E
Routing table
B : 0 [Local] Routing table
C : 0 [Local]
Routing table
E : 0 [Local]
Routing table
D : 0 [Local]
Cost=1
Cost=1
Cost=1
Cost=1
Cost=1
Cost=1
44. Distance vector
example (2)
C
D E
Routing table
A : 0 [ Local ]
A B C
D E
Routing table
B : 0 [Local]
A : 1 [West]
Routing table
C : 0 [Local]
Routing table
E : 0 [Local]
Routing table
D : 0 [Local]
A : 1 [North]
D=0 ; A=1
D=0 ; A=1
45. Distance vector
example (3)
C
D E
Routing table
A : 0 [ Local ]
D : 1 [South]
A B C
D E
Routing table
B : 0 [Local]
A : 1 [West]
Routing table
C : 0 [Local]
Routing table
E : 0 [Local]
D : 1 [West]
A : 2 [West]
Routing table
D : 0 [Local]
A : 1 [North]
C=0
C=0
46. Distance vector
example (4)
C
D E
Routing table
A : 0 [ Local ]
D : 1 [South]
A B C
D E
Routing table
B : 0 [Local]
A : 1 [West]
C : 1 [East]
Routing table
C : 0 [Local]
Routing table
E : 0 [Local]
D : 1 [West]
A : 2 [West]
C : 1 [North-East]
Routing table
D : 0 [Local]
A : 1 [North]
E=0;D=1;A=2;C=1
E=0;D=1;A=2;C=1
E=0;D=1;A=2;C=1
47. Distance vector
example (5)
C
D E
Routing table
A : 0 [ Local ]
D : 1 [South]
A B C
D E
Routing table
B : 0 [Local]
A : 1 [West]
C : 1 [East]
E : 1 [South]
D : 2 [South]
Routing table
C : 0 [Local]
E : 1 [South-West]
D : 2 [South-West]
A : 3 [South-West]
Routing table
E : 0 [Local]
D : 1 [West]
A : 2 [West]
C : 1 [North-East]
Routing table
D : 0 [Local]
A : 1 [North]
E : 1 [East]
C : 2 [East]
B=0;A=1;C=1;D=2;E=1
B=0;A=1;C=1;D=2;E=1
48. Distance vector
example (6)
C
D E
Routing table
A : 0 [ Local ]
D : 1 [South]
B : 1 [East]
C : 2 [East]
E : 2 [East]
A B C
D E
Routing table
B : 0 [Local]
A : 1 [West]
C : 1 [East]
E : 1 [South]
D : 2 [South]
Routing table
C : 0 [Local]
E : 1 [South-West]
D : 2 [South-West]
A : 2 [West]
B : 1 [West]
Routing table
E : 0 [Local]
D : 1 [West]
A : 2 [West]
C : 1 [North-East]
B : 1 [North]
Routing table
D : 0 [Local]
A : 1 [North]
E : 1 [East]
C : 2 [East]
A=0;B=1;C=2;D=1;E=2
49. Distance vector
example (7)
C
D E
Routing table
A : 0 [ Local ]
D : 1 [South]
B : 1 [East]
C : 2 [East]
E : 2 [East]
A B C
D E
Routing table
B : 0 [Local]
A : 1 [West]
C : 1 [East]
E : 1 [South]
D : 2 [South]
Routing table
C : 0 [Local]
E : 1 [South-West]
D : 2 [South-West]
A : 2 [West]
B : 1 [West]
Routing table
E : 0 [Local]
D : 1 [West]
A : 2 [West]
C : 1 [North-East]
B : 1 [North]
Routing table
D : 0 [Local]
A : 1 [North]
E : 1 [East]
C : 2 [East]
B : 2 [North]
50. Agenda
• Reliable transmission
• Building a network
• Datagram organisation
• Virtual circuit organisation
• Distance vector routing
• Link state routing
51. Link state routing
• Objectives of the routing protocol
• Compute all forwarding tables
• Principle
• Each node detects its direct neighbors
• Each node regularly sends the list of
its direct neighbors to all nodes
53. Link state packets
• How to reliably send LSPs to all nodes ?
C
D E
Links
A-B : 1
A-D : 1
A B C
D E
Links
B-C : 1
C-E : 1
Links
E-D : 1
E-B : 1
E-C : 1
Links
A-D : 1
D-E : 1
Links
A-B : 1
B-E : 1
B-C : 1
Links
A-D : 1
D-E : 1
LSP : E [D:1];[B:1];[C:1]
LSP : E [D:1];[B:1];[C:1] LSP : E [D:1];[B:1];[C:1]
54. Distributing LSPs
• Naive approach
• Forward received LSP to all neighbors
C
D E
Links
A-B : 1
A-D : 1
A B C
D E
Links
B-C : 1
C-E : 1
B-E : 1
D-E : 1
Links
E-D : 1
E-B : 1
E-C : 1
Links
A-B : 1
B-E : 1
B-C : 1
E-D : 1
E-C : 1
Links
A-D : 1
D-E : 1
B-E : 1
E-C : 1
LSP : E [D:1];[B:1];[C:1]
LSP : E [D:1];[B:1];[C:1]
LSP : E [D:1];[B:1];[C:1]
With this approach, LSPs will loop forever...
55. Flooding
C
D E
Links
A-B : 1
A-D : 1
A B C
D E
Links
B-C : 1
C-E : 1
Links
E-D : 1
E-B : 1
E-C : 1
Links
A-D : 1
D-E : 1
Links
A-B : 1
B-E : 1
B-C : 1
Links
A-D : 1
D-E : 1
LSP : E-0 [D:1];[B:1];[C:1]
LSP : E-0 [D:1];[B:1];[C:1] LSP : E-0 [D:1];[B:1];[C:1]
LSPs
LSPs
LSPs
E-0 [D:1];[B:1];[C:1]
LSPs
LSPs
New LSP, flood
!
New LSP, flood
!
New
LSP, flood !