Andriy Berestovskyy
2017
Networking Fundamentals
Transport Protocols
( ц ) А н д р
і й Б е р е с
т о в с ь к и
й
networking hour
TCP
UDP
NAT
IPsec
IPv4
IPv6
internet
protocolsAH
ESP
authentication
authorization
accounting
encapsulation
security
BGP
OSPF
ICMP
ACLSNAT
tunnel
PPPoE
GRE
ARP
discovery
NDP
OSI
broadcast
multicast
IGMP
PIM
MAC
DHCP
DNS
fragmentation
semihalf
berestovskyy
Networking Fundamentals
● Computer Networks
● Networking Models
● Local Networks
● Internet
● IPv4 Routing
● > Transport Protocols
2
IPv4 Transport Layer
3
Application
Presentation
Session
Transport
Network
Data Link
Physical
Frame
Bits
MAC Data FCS
IP Data
TCP Data
Packet
Segment
Data
7
6
5
4
3
2
1
Hi!
Salut!
Transmission Control Protocol
● Connection Oriented
● Ordered Delivery
● Error Recovery
● Flow Control
● Multiplexing
4
How?
Other L4
protocols?
Source/Destination Port — for multiplexing
Seq — seq number of the first data byte
Ack — next seq number sender is expecting
Data offset — size of header in 32-bit words, usually 5
Flags — Flags (ACK, PSH, RST, SYN, FIN, etc…)
Window Size —size of the receive window
Checksum — TCP header, data and pseudo-header
Urgent Pointer — offset to last urgent byte
Options — usually empty
TCP Header
5
Source Port Destination Port
Sequence Number
Acknowledgement Number
Off
TCP Checksum
Data
...
[Options …]
0 32
Protected by
TCP Checksum
DataOffset
Flags Window Size
Urgent Pointer
Pseudo
header?
Examples?
Ver IHL DSCP Total LengthE
ID Fl Fragment Offset
TTL Proto = TCP IP Header Checksum
Source Address
Destination Address
[Options …]
0 32
IHL
Protected by IP
Header Checksum
Transport Layer Multiplexing
google.com
Client
100.3.2.5
Server
1.1.1.1
DNS QUERYTo: 1.1.1.11
Src/dst IPs are
the same
How to
distinct?
HTTP GET /To: 1.1.1.12
HTTP GET logo.jpgTo: 1.1.1.13
Multiplexing using Sockets
google.com
Client
100.3.2.5
DNS QUERYTo: 1.1.1.1
Src: 1025
Dst: 53
1
HTTP GET /To: 1.1.1.1
Src: 1026
Dst: 80
2
HTTP GET logo.jpgTo: 1.1.1.1
Src: 1027
Dst: 8080
3
SOCKET 1:
IP: 1.1.1.1
Protocol: UDP
Port: 53
Why 1025?
SOCKET 2:
IP: 1.1.1.1
Protocol: TCP
Port: 80
SOCKET 3:
IP: 1.1.1.1
Protocol: TCP
Port: 8080
Socket?
Why 53?
Network socket — internal endpoint for sending or receiving data
at a single node in a computer network
— Wikipedia
8
Well-Known* Port Numbers
9
20
Port Proto Service
* See /etc/services for more
TCP File Transfer Protocol data connectionftp-data
Unix Name
21 TCP File Transfer protocol control connectionftp
22 TCP Secure shellssh
25 TCP Simple Mail Transfer Protocolsmtp
53 UDP Domain Name System requestdomain
69 UDP Dynamic Host Configuration Protocolbootps
69 UDP Trivial File Transfer Protocoltftp
80 TCP World Wide Webhttp
Socket Connections
10
Client
DNS
Resolver
1025
Web
Browser
Web
Browser
1026 1027
TCP
(100.3.2.5, TCP, 1027)
(100.3.2.5, TCP, 1026)
(100.3.2.5, UDP, 1025)
IP 100.3.2.5
UDP
Server
DNS
Server
53
Web
Server
Web
Server
80 8080
TCP
IP 100.3.2.5
UDP
(1.1.1.1, TCP, 8080)
(1.1.1.1, TCP, 80)
(1.1.1.1, UDP, 53)
TCP Connection Establishment
Server
Port: 80
Src: 1026, Dst: 80
SYN 132
1
Client
Port: 1026
Source Port Destination Port
Sequence Number
Acknowledgement Number
Off
TCP Checksum
Data
...
[Options …]
0 32
Flags: SYN ACK Window Size
Urgent Pointer
Src: 80, Dst: 1026
SYN 69, ACK 132+1
2
Src: 1026, Dst: 80
ACK 69+1
3
11
TCP Error Recovery
12
TCP Client TCP
ACK 701
Data
[ ...
HTTP
GET /
HTTP
OK
TCP
SEQ 70
...SEQ 80
… ]SEQ 90
ACK 80
...SEQ 80
2
3
4
6
TCP Server
5
TCP Connection Termination
Server
Port: 80
Src: 1026, Dst: 80
FIN 99
1
Client
Port: 1026
Source Port Destination Port
Sequence Number
Acknowledgement Number
Off
TCP Checksum
Data
...
[Options …]
0 32
Flags: FIN ACK Window Size
Urgent Pointer
Src: 1026, Dst: 80
ACK 142+1
4
Src: 80, Dst: 1026
ACK 99+1
2
Src: 80, Dst: 1026
ACK 99+1, FIN 142
3
13
User Datagram Protocol
● Connection Oriented
● Connectionless
● Ordered Delivery
● Error Recovery
● Flow Control
● Multiplexing
14
Usage?
Source/Destination Port — for multiplexing
Length —length of UDP header and data
Checksum — header, data and pseudo-header
UDP Header
15
Source Port Destination Port
Length
Data
...
0 32
Protected by
UDP Checksum
8B
UDP Checksum
Pseudo
header?
Ver IHL DSCP Total LengthE
ID Fl Fragment Offset
TTL Proto = UDP IP Header Checksum
Source Address
Destination Address
[Options …]
0 32
IHL
Protected by IP
Header Checksum
TCP vs UDP
16
UDP TCP
Header size
Feature
Data unit
Connection oriented
Reliable transport
Preserve message boundary
Ordered delivery
Data checksum
Flow control
TCP vs UDP
17
8
UDP TCP
20-60Header size
Feature
Datagram SegmentData unit
No YesConnection oriented
No YesReliable transport
Yes NoPreserve message boundary
No YesOrdered delivery
Optional YesData checksum
No YesFlow control Flow
control?
Quality of Service (QoS) — measurement of the overall
performance of a service seen by the users of the network
— Wikipedia
18
Bandwidth
— number of bits available per time in a communication channel
End-to-end delay
— time for a packet to be transmitted across a network
Jitter
— deviation in end-to-end delays
Packet loss
— rate of packets lost / packets sent
Quality of Service Characteristics
19
End-to-end?
End-to-End QoS
LAN
End-to-End QoS
Example Services Requirements
21
Bandwidth Delay
Web browsing
Service
Voice calling
Videoconference
Gaming
Jitter Loss
Peer-to-peer downloading
Example Services Requirements
22
Medium
Bandwidth Delay
MediumWeb browsing
Service
Low LowVoice calling
Medium LowVideoconference
Low LowGaming
Jitter Loss
Medium
Low
Low
Low
Medium
Low
Low
Low
High HighPeer-to-peer downloading High High
How?
23
QoS Overview
Classification Policer
Drop
Scheduler
How?
24
QoS Classification
Payload
...
MAC Destination
MAC Destination MAC Source
MAC Source
Ethertype
0 32
Frame Check Sequence
0x8100 VIDPCP D
Ver IHL DSCP Total LengthE
ID Fl Fragment Offset
TTL Protocol Header Checksum
Source Address
Destination Address
Payload
...
[Options …]
0 32
Ethernet Header IPv4 Header
DSCP — Differentiated Services Code Point (6 bits)
ECN — Explicit Congestion Notification (2 bits)
PCP — Priority Code Point (Class of service) (3 bits)
DEI — Drop Eligible Indicator (1 bit)
Transport Protocols Checklist
1. TCP services?
2. Socket?
3. TCP connection establishment?
4. UDP services?
5. TCP vs UDP?
6. QoS?
25
References
1. Kevin Wallace. CCNP Routing and Switching ROUTE 300-101 Official Cert Guide. Cisco Press, 2014
2. David Hucaby. CCNP Routing and Switching SWITCH 300-115 Official Cert Guide. Cisco Press, 2014
3. RFC 1122. Requirements for Internet Hosts — Communication Layers.
4. IANA Protocol Numbers: http://www.iana.org/assignments/protocol-numbers
26

Networking Fundamentals: Transport Protocols (TCP and UDP)

  • 1.
    Andriy Berestovskyy 2017 Networking Fundamentals TransportProtocols ( ц ) А н д р і й Б е р е с т о в с ь к и й networking hour TCP UDP NAT IPsec IPv4 IPv6 internet protocolsAH ESP authentication authorization accounting encapsulation security BGP OSPF ICMP ACLSNAT tunnel PPPoE GRE ARP discovery NDP OSI broadcast multicast IGMP PIM MAC DHCP DNS fragmentation semihalf berestovskyy
  • 2.
    Networking Fundamentals ● ComputerNetworks ● Networking Models ● Local Networks ● Internet ● IPv4 Routing ● > Transport Protocols 2
  • 3.
    IPv4 Transport Layer 3 Application Presentation Session Transport Network DataLink Physical Frame Bits MAC Data FCS IP Data TCP Data Packet Segment Data 7 6 5 4 3 2 1 Hi! Salut!
  • 4.
    Transmission Control Protocol ●Connection Oriented ● Ordered Delivery ● Error Recovery ● Flow Control ● Multiplexing 4 How? Other L4 protocols?
  • 5.
    Source/Destination Port —for multiplexing Seq — seq number of the first data byte Ack — next seq number sender is expecting Data offset — size of header in 32-bit words, usually 5 Flags — Flags (ACK, PSH, RST, SYN, FIN, etc…) Window Size —size of the receive window Checksum — TCP header, data and pseudo-header Urgent Pointer — offset to last urgent byte Options — usually empty TCP Header 5 Source Port Destination Port Sequence Number Acknowledgement Number Off TCP Checksum Data ... [Options …] 0 32 Protected by TCP Checksum DataOffset Flags Window Size Urgent Pointer Pseudo header? Examples? Ver IHL DSCP Total LengthE ID Fl Fragment Offset TTL Proto = TCP IP Header Checksum Source Address Destination Address [Options …] 0 32 IHL Protected by IP Header Checksum
  • 6.
    Transport Layer Multiplexing google.com Client 100.3.2.5 Server 1.1.1.1 DNSQUERYTo: 1.1.1.11 Src/dst IPs are the same How to distinct? HTTP GET /To: 1.1.1.12 HTTP GET logo.jpgTo: 1.1.1.13
  • 7.
    Multiplexing using Sockets google.com Client 100.3.2.5 DNSQUERYTo: 1.1.1.1 Src: 1025 Dst: 53 1 HTTP GET /To: 1.1.1.1 Src: 1026 Dst: 80 2 HTTP GET logo.jpgTo: 1.1.1.1 Src: 1027 Dst: 8080 3 SOCKET 1: IP: 1.1.1.1 Protocol: UDP Port: 53 Why 1025? SOCKET 2: IP: 1.1.1.1 Protocol: TCP Port: 80 SOCKET 3: IP: 1.1.1.1 Protocol: TCP Port: 8080 Socket? Why 53?
  • 8.
    Network socket —internal endpoint for sending or receiving data at a single node in a computer network — Wikipedia 8
  • 9.
    Well-Known* Port Numbers 9 20 PortProto Service * See /etc/services for more TCP File Transfer Protocol data connectionftp-data Unix Name 21 TCP File Transfer protocol control connectionftp 22 TCP Secure shellssh 25 TCP Simple Mail Transfer Protocolsmtp 53 UDP Domain Name System requestdomain 69 UDP Dynamic Host Configuration Protocolbootps 69 UDP Trivial File Transfer Protocoltftp 80 TCP World Wide Webhttp
  • 10.
    Socket Connections 10 Client DNS Resolver 1025 Web Browser Web Browser 1026 1027 TCP (100.3.2.5,TCP, 1027) (100.3.2.5, TCP, 1026) (100.3.2.5, UDP, 1025) IP 100.3.2.5 UDP Server DNS Server 53 Web Server Web Server 80 8080 TCP IP 100.3.2.5 UDP (1.1.1.1, TCP, 8080) (1.1.1.1, TCP, 80) (1.1.1.1, UDP, 53)
  • 11.
    TCP Connection Establishment Server Port:80 Src: 1026, Dst: 80 SYN 132 1 Client Port: 1026 Source Port Destination Port Sequence Number Acknowledgement Number Off TCP Checksum Data ... [Options …] 0 32 Flags: SYN ACK Window Size Urgent Pointer Src: 80, Dst: 1026 SYN 69, ACK 132+1 2 Src: 1026, Dst: 80 ACK 69+1 3 11
  • 12.
    TCP Error Recovery 12 TCPClient TCP ACK 701 Data [ ... HTTP GET / HTTP OK TCP SEQ 70 ...SEQ 80 … ]SEQ 90 ACK 80 ...SEQ 80 2 3 4 6 TCP Server 5
  • 13.
    TCP Connection Termination Server Port:80 Src: 1026, Dst: 80 FIN 99 1 Client Port: 1026 Source Port Destination Port Sequence Number Acknowledgement Number Off TCP Checksum Data ... [Options …] 0 32 Flags: FIN ACK Window Size Urgent Pointer Src: 1026, Dst: 80 ACK 142+1 4 Src: 80, Dst: 1026 ACK 99+1 2 Src: 80, Dst: 1026 ACK 99+1, FIN 142 3 13
  • 14.
    User Datagram Protocol ●Connection Oriented ● Connectionless ● Ordered Delivery ● Error Recovery ● Flow Control ● Multiplexing 14 Usage?
  • 15.
    Source/Destination Port —for multiplexing Length —length of UDP header and data Checksum — header, data and pseudo-header UDP Header 15 Source Port Destination Port Length Data ... 0 32 Protected by UDP Checksum 8B UDP Checksum Pseudo header? Ver IHL DSCP Total LengthE ID Fl Fragment Offset TTL Proto = UDP IP Header Checksum Source Address Destination Address [Options …] 0 32 IHL Protected by IP Header Checksum
  • 16.
    TCP vs UDP 16 UDPTCP Header size Feature Data unit Connection oriented Reliable transport Preserve message boundary Ordered delivery Data checksum Flow control
  • 17.
    TCP vs UDP 17 8 UDPTCP 20-60Header size Feature Datagram SegmentData unit No YesConnection oriented No YesReliable transport Yes NoPreserve message boundary No YesOrdered delivery Optional YesData checksum No YesFlow control Flow control?
  • 18.
    Quality of Service(QoS) — measurement of the overall performance of a service seen by the users of the network — Wikipedia 18
  • 19.
    Bandwidth — number ofbits available per time in a communication channel End-to-end delay — time for a packet to be transmitted across a network Jitter — deviation in end-to-end delays Packet loss — rate of packets lost / packets sent Quality of Service Characteristics 19 End-to-end?
  • 20.
  • 21.
    Example Services Requirements 21 BandwidthDelay Web browsing Service Voice calling Videoconference Gaming Jitter Loss Peer-to-peer downloading
  • 22.
    Example Services Requirements 22 Medium BandwidthDelay MediumWeb browsing Service Low LowVoice calling Medium LowVideoconference Low LowGaming Jitter Loss Medium Low Low Low Medium Low Low Low High HighPeer-to-peer downloading High High How?
  • 23.
  • 24.
    24 QoS Classification Payload ... MAC Destination MACDestination MAC Source MAC Source Ethertype 0 32 Frame Check Sequence 0x8100 VIDPCP D Ver IHL DSCP Total LengthE ID Fl Fragment Offset TTL Protocol Header Checksum Source Address Destination Address Payload ... [Options …] 0 32 Ethernet Header IPv4 Header DSCP — Differentiated Services Code Point (6 bits) ECN — Explicit Congestion Notification (2 bits) PCP — Priority Code Point (Class of service) (3 bits) DEI — Drop Eligible Indicator (1 bit)
  • 25.
    Transport Protocols Checklist 1.TCP services? 2. Socket? 3. TCP connection establishment? 4. UDP services? 5. TCP vs UDP? 6. QoS? 25
  • 26.
    References 1. Kevin Wallace.CCNP Routing and Switching ROUTE 300-101 Official Cert Guide. Cisco Press, 2014 2. David Hucaby. CCNP Routing and Switching SWITCH 300-115 Official Cert Guide. Cisco Press, 2014 3. RFC 1122. Requirements for Internet Hosts — Communication Layers. 4. IANA Protocol Numbers: http://www.iana.org/assignments/protocol-numbers 26