2 TCP - Ip Ii
2 TCP - Ip Ii
TCP/IP II
7th edition
Jim Kurose, Keith Ross
Pearson/Addison Wesley
April 2016
transport
network
link
physical
provide logical n
transport
lo
different hosts
gi
ca
transport protocols run in
enl
end systems
d-
en
• send side: breaks app
d
tr
messages into
ans
segments, passes to
po
tr
network layer
• rcv side: reassembles applicatio
n
segments into transport
network
messages, passes to data link
physical
app layer
more than one transport
protocol available to apps
• Internet: TCP and UDP
Transport Layer 3-3
Internet transport-layer
protocols
reliable, in-order applicatio
n
transport
delivery (TCP) network
data link
network
• congestion control physical
lo
network data link
gi
data link physical
• flow control
ca
physical
network
l en
data link
• connection setup
d-
physical
en
unreliable, network
d
data link
tr
unordered delivery:
a
physical
ns
network
po
UDP data link
r
physical
t
network
• no-frills extension of data link
physical
applicatio
n
“best-effort” IP network
data link transport
network
services not
physical
data link
physical
available:
• delay guarantees
• bandwidth
guarantees Transport Layer 3-4
Sockets
• Application processes sends messages to (or receives
messages from) transport layer through socket.
• socket programming is for this purpose: socket.send(M)
and M=socket.recv()
process socket
application
P3
transport
network
link
physical
application application
application
P3 P1 P2 P4
Host 1 Host 3
3-8
UDP demux: example
application port
6428
application port P1
port
5775
application
P3 9157
P4
sport 5775
sport 9175 dport 6428
dport 6428 s-ip: C
s-ip: A d-ip: B
d-ip: B
dport 6428
sport 5776
d-ip: B
s-ip: C
Transport Layer 3-11
UDP: User Datagram Protocol
[RFC 768]
“no frills,” “bare bones” UDP use:
transport protocol streaming
“best effort” service, multimedia apps
UDP segments may be: (loss tolerant, rate
• lost sensitive)
• delivered out-of-order DNS
to app SNMP
connectionless:
reliable transfer
• no handshaking
between UDP sender, over UDP:
receiver add reliability at
• each UDP segment application layer
handled application-specific
independently of error recovery!
others
Transport Layer 3-12
UDP: segment header
length, in bytes of
32 bits UDP segment,
source port # dest port # including header
length checksum
why is there a UDP?
no connection
application establishment (which
data can add delay)
(payload) simple: no connection
state at sender,
receiver
small header size
UDP segment format no congestion control:
UDP can blast away as
fast as desired
Acknowledge number:
• ack_num=seq# of next packet expected
from other side source port # dest port #
• ack_num=502: sequence number
acknowledgement number
please send your packet with A rwnd
seq#=502. checksum urg pointer
• means packets with seq#<502 have
been received.
User
types
‘C’
Seq=42, ACK=79, data = ‘C’
host ACKs
receipt of
‘C’, echoes
Seq=79, ACK=43, data = ‘C’ back ‘C’
host ACKs
receipt
of echoed
‘C’ Seq=43, ACK=80
SendBase=92
Seq=92, 8 bytes of data Seq=92, 8 bytes of data
timeo
ACK=100
ut
ut
X
ACK=100
ACK=120
SendBase=120
X
ut
ACK=120
cumulative ACK
Transport Layer 3-21
TCP flow control
application
application may process
remove data from application
TCP socket buffers ….
TCP socket OS
receiver buffers
… slower than
TCP
receiver is TCP
delivering code
(sender is
sending)
IP
flow control code
receiver controls sender,
so sender won’t overflow
receiver’s buffer by from sender
transmitting too much,
receiver protocol stack
too fast
SYNSENT
SYN RCVD
ESTAB
ESTAB
transport
network
link
physical
Routing
Algorithm
control
plane
data
plane
values in arriving
packet header
0111 1
2
3
routing, management
routing control plane (software)
processor operates in millisecond
time frame
forwarding data plane
(hardware) operttes
in nanosecond
timeframe
high-seed
switching
fabric
physical layer:
bit-level reception decentralized switching:
data link layer: destination-based forwarding: forward
e.g., Ethernet based only on destination IP address
(chapter 5) (traditional)
generalized forwarding: forward based
on any set of header field values
queuing: if datagrams arrive faster
than forwarding rate into switch fabric
• if queue is full, the arriving packet is
dropped.
Network Layer: Data Plane 4-30
Destination-based
forwarding
forwarding table
Destination IP Address Range Link Interface
otherwise 3
examples:
DA: 11001000 00010111 00010110 10100001 which interface?
DA: 11001000 00010111 00011000 10101010 which interface?
Network Layer: Data Plane 4-32
Switching via memory
first generation routers:
traditional computers with switching under
direct control of CPU
packet copied to system’s memory
input output
port memory port
(e.g., (e.g.,
Ethernet) Ethernet)
system bus
datagram
switch buffer link
fabric layer line
protocol termination
queueing (send)
…
• vary on link types in: one large datagram
large IP datagram out: 3 smaller datagrams
divided
(“fragmented”) within
net
reassembly
• one datagram
becomes several
datagrams
• “reassembled” only …
at final destination
• IP header bits used
to identify, order
related fragments
Network Layer: Data Plane 4-36
IP addressing: introduction
223.1.1.1
IP address: 32-bit
identifier for host, 223.1.2.1
connection between
host/router and 223.1.1.3
223.1.3.27
each isolated
network is called 223.1.3.0/24
a subnet
subnet mask: /24
Network Layer: Data Plane 4-39
DHCP: Dynamic Host Configuration
Protocol
goal: allow host to dynamically obtain its IP address
from network server when it joins network
223.1.2.0/24
223.1.3.1 223.1.3.2
223.1.3.0/24
Network Layer: Data Plane 4-41
DHCP client-server
scenario
DHCP server: 223.1.2.5 DHCP discover arriving
client
src : 0.0.0.0, 68
Broadcast: is there a
dest.: 255.255.255.255,67
DHCP server
yiaddr: 0.0.0.0out
transaction
there?ID: 654
DHCP offer
src: 223.1.2.5, 67
Broadcast: I’m a DHCP
dest: 255.255.255.255, 68
server! Here’s an IP
yiaddrr: 223.1.2.4
transaction ID: 654
address you can use
lifetime: 3600 secs
DHCP request
src: 0.0.0.0, 68
dest:: 255.255.255.255, 67
Broadcast: OK. I’ll
yiaddrr: 223.1.2.4
take that IPID:address!
transaction 655
lifetime: 3600 secs
DHCP ACK
src: 223.1.2.5, 67
dest: 255.255.255.255,
Broadcast: 68
OK. You’ve
yiaddrr: 223.1.2.4
gottransaction
that IPID:address!
655
lifetime: 3600 secs
Network Layer: Data Plane 4-42