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
2. Agenda
• Reliable transport
• Multiplexing
• Connection establishment
• Data transfer
• Connection release
• Sharing resources
3. Multiplexing
Server
Client
Source port : 1234
Destination port: 5678
Request
Response
Source port : 5678
Destination port: 1234
Source Addr: Client
Dest. Addr: Server
Source Addr: Server
Dest. Addr: Client
4. Connection table
• A server interacts with many different
clients and maintains a connection table
• This table contains one entry per
active connection with its state
• Each connection is identified by 4
infos
• Client address and port
• Server address and port
5. Agenda
• Reliable transport
• Multiplexing
• Connection establishment
• Data transfer
• Connection release
• Sharing resources
• Security principles
6. Coping with delayed
segments
• How to deal with delayed segments ?
• Network level guarantee
• No packet will survive more than MSL
seconds inside the network
• Transport entities use on a local clock to
detect duplicated connection
establishment requests
7. Three way
handshake
CR (seq=x)
CA (seq=y, ack=x)
CA (seq=x, ack=y)
Sequence number x read
from local transport clock
Local state :
Connection to B :
- Wait for ack for CR (x)
- Start retransmission timer
Sequence number y read from
local transport clock
CA sent to ack CR
Local state :
Connection to A :
- Wait for ack for CA(y)
Received CA acknowledges CR
Send CA to ack received CA
Local state :
Connection to B :
- established
- current_seq = x
The sequence numbers used
for the data segments will start
from x
The sequence numbers
used for the data segments
will start from y
D(x)
D(y)
Local state :
Connection to A :
- established
- current_seq=y
Connection established
Connection established
Host A Host B
8. Client FSM
Connect.req
Send CR
Timer expires
Send CR
Recvd REJECT
Disconnect.ind
Recvd(CA)
Connect.conf / Send CA
Recvd REJECT
Disconnect.ind
In any state, a Disconnect.ind (abrupt)
-> Send REJECT and transition to red state
9. Server FSM
Recvd (CR)
Connect.ind
Connect.resp
Send CA
Recvd REJECT
Disconnect.ind
Recvd REJECT
Disconnect.ind
Recvd CA
In any state, a Disconnect.ind (abrupt)
-> Send REJECT and transition to red state
Recvd CR
Recvd CR
Send CA
10. Three way handshake
(2)
CA (seq=y, ack=z)
CR (seq=z)
REJECT (ack=y)
Connection cancelled
No connection is established
Host A Host B
Sequence number y read from
local transport clock
Acknowledges CR segment
Local state :
Connection to A :
- Wait for ack for CA(y)
Local state :
No connection to B
Send REJECT to cancel
connection establishment
11. Three way handshake
(3)
CR (seq=z)
Current state does not contain
a CR with seq=x
REJECT (ack=y)
Connection established
CR (seq=z)
Retransmission timer
expires
CA (seq=w, ack=z)
CA (seq=z, ack=w)
CA (seq=y, ack=x)
Sequence number z read
from local transport clock
Local state :
Connection to B :
- Wait for ack for CR (z)
- Start retransmission timer
Host A Host B
Current state does not contain
a segment with seq=y
REJECT ignored
Sequence number w read from
local transport clock
CA sent to ack CR
Local state :
Connection to A :
- Wait for ack for CA(w)
Received CA acknowledges CR
Send CA to ack received CA
Local state :
Connection to B :
- established
- current_seq = z
12. Three way handshake
(4)
Invalid CA received from A
Send REJECT
CA (seq=w, ack=z)
CR (seq=z)
CA (seq=z, ack=y)
REJECT (ack=w)
REJECT (ack=z)
Sequence number w read from
local transport clock
Acknowledges CR segment
Local state :
Connection to A :
- Wait for ack for CA(w)
Current state does not contain
a CR with seq=z
Host A Host B
No connection is established
13. Agenda
• Reliable transport
• Multiplexing
• Connection establishment
• Data transfer
• Connection release
• Sharing resources
• Security principles
14. Reliable data transfer
• What are the main differences with the
reliable protocols of the datalink layer ?
• Segments can be reordered
• Buffers can change dynamically
• Bytestream service
15. Buffer management
• A transport entity serves a variable
number of applications with a limited
buffer
• The buffer/window allocated to a
given connection may need to change
dynamically as connections start and
stop
17. Buffer management
A B
Data.req(b)
Data.ind(a)
Data.req(a)
D(0,a)
C(OK,0, w=0)
2 new buffers are
available
0 1 2 3
Rwin=1
0 1 2 3
Swin=3, rwin=1
0 1 2 3
Swin=3, rwin=1
0 1 2 3
Receiver cannot handle
segment immediately
C(OK,0,w=3)
Lost segment
0 1 2 3
Swin=3, rwin=0
Window blocked
No transmission possible
Waits for control segment Waits for data segment
How to recover from deadlock ?
Persistence timer on receiver,
resend control segment after
timer expiration
19. Delayed segments
• How to deal with them ?
• Packets cannot live more than MSL
seconds inside the network
• Only one segment carrying sequence
number x can be transmitted during MSL
seconds
• upper bound on maximum throughput
23. Byte stream service (2)
A B
Data.req(ijkl)
Data.req(mnop)
Data.req(abcdef)
Data.ind(ab)
D(0,ab)
C(OK,1)
C(OK,1)
D(2,cd)
Lost segment
D(4,ef)
Placed in buffer
Data.ind(cdef)
D(2,cd)
Expiration timer
Retransmission
D(6,ijklmnop)
Data.ind(ijklmnop)
C(OK,5)
C(OK,13)
24. Agenda
• Reliable transport
• Multiplexing
• Connection establishment
• Data transfer
• Connection release
• Sharing resources
• Security principles
25. Connection release
• Graceful release
• Data transfer finished and connection
must be terminated
• Abrupt release
• Something went wrong and the
connection must be closed immediately
• Data can be lost !
28. Abrupt release
CR (seq=z)
CA (seq=w, ack=z)
CA (seq=z, ack=w)
D
Data.req()
Data.ind()
Disc.req()
D
Data.req()
DR
Disc.req()
Connection closed
Connection closed
This segment will not be delivered !
29. Agenda
• Reliable transport
• Sharing resources
• Which resources need to be shared
• Medium Access Control
• Congestion Control
37. Agenda
• Reliable transport
• Sharing resources
• Which resources need to be shared
• Medium Access Control
• Congestion Control
38. Adapting to different
bandwidth
What is the round-trip-time in
milliseconds this network if A sends
10,000 bits segments, all links are 1
m long and B returns 100 bits acks ?
If A sends four 10,000 bits
segments in a row, after how
many msec will it receive the last
40. The congestion
problem
• If R1 has a buffer of five 10,000 bits long
packets, how many packets will be dropped
if A and B send a burst of ten packets at
line rate ?
41. Fairness
• What is the final objective of congestion
control ?
• On a single link
• Fair share
• In a large network
• Max-min fairness
42. Max-min fairness
• a max-min allocation of bandwidth is an
allocation of bandwidth which
maximises the allocation of bandwidth
to the sources receiving the smallest
allocation
• a max-min fair allocation is such that
in order to increase the bandwidth
allocated to one source, it is
necessary to decrease the bandwidth
allocated to another source which
already receives a lower allocation
43. Max-min fairness
• a max-min allocation maximises the
allocation of bandwidth to the sources
receiving the smallest allocation
• Property
• to increase the bandwidth allocated to
one source, it is necessary to
decrease the bandwidth allocated to
another source which already
receives a lower allocation
44. Example
• Max-min fair bandwidth allocation
R
R
R
R
R
1000 Mbps
100 Mbps
S1
S2
S3 S4 S5 S6 S7 S8
D1 D3 D4
D2
D5
D6
D7
D8
Link1
Link2
Link3
Link4
45. How to achieve
max-min fairness ?
• Two possible approaches
• Modify the routers to reach max-min
fairness
• Modify the endhosts to reach max-min
fairness
46. How to detect
congestion ?
• Packet losses
• Increased delay
• Routers add information to packets
• Forward binary feedback
• Backward binary feedback
• Rate feedback
50. Router output port
Q[1]
Q[2]
Q[3]
Q[N]
Flow identification
Input links
Output link
Flow identification
Identifies the TCP/UDP flow
to which the arriving packet
belongs
Buffer acceptance
accepts or rejects
incoming packets
Queuing strategy
Logical organization of the
router's buffers
Scheduler
Chooses the packet to
be transmitted first on
the output link
51. Round robin
Flow 2
Flow 1
Flow 3
Flow 4
Flow 5
Flow 1
Flow 2
Flow 3
Flow N
Scheduler :
F1
F2
F3
F4
FN
52. Round robin
• If the RR scheduler starts with queue1
and serves them in numerical order,
what is the ordering of the packets on
the output link ?
A
B
D
E
F
G
Queue 1
Queue 2
Queue 3
54. Round-Robin
• Advantage
• Can provide fairness independently of
the characteristics of the flows
• Drawback
• Difficult to scale to a very large
number of flows
Editor's Notes
In this example, the duplicate CR is likely to be a previous retransmission of the CR that was delayed in the network.
MSL means Maximum Segment Lifetime
How to determine a max-min fair bandwidth allocation for a given network ?
Algorithm [Bertsekas & Gallager, Data Networks, 2nd edition, Prentice Hall 1992]
First start with an allocation of 0 Mbps for each source
Then equally increment the allocation to each source until one link becomes saturated. At this point, each source which uses the saturated link receives an allocation equal to the bandwidth of this saturated link divided by the number of sources using this bottleneck link.
Next, the allocation of all the sources which do not use a saturated link is equally incremented until another link becomes saturated.
The algorithm continues from step to step, always incrementing the allocation of the sources which do not use a saturated link, until all sources use at least one of the saturated links.