1.5 Compare how TCP and UDP behave

CCNA 200-301 v1.1 · 1.0 Network Fundamentals

TCP and UDP both carry application data between ports on two hosts. TCP is connection-oriented and reliable: it sets up a session, numbers every byte, acknowledges and retransmits, and slows down when the network is busy. UDP just sends datagrams with no setup and no guarantees, which suits voice, video, DNS and anything that prefers speed to completeness.

What you must know

Side by side

TCPUDP
ConnectionThree-way handshake firstNone
ReliabilityAcknowledgements and retransmissionNone
OrderingSequence numbers reorder dataNone
Flow controlSliding windowNone
Header20 bytes (minimum)8 bytes
Used byHTTP/HTTPS, SSH, Telnet, FTP, SMTP, BGPDNS queries, DHCP, TFTP, SNMP, syslog, NTP, voice and video (RTP)

Setting up and closing a TCP session

  1. SYN: the client picks a random sequence number and asks to connect to the server's port.
  2. SYN-ACK: the server acknowledges it and sends its own sequence number.
  3. ACK: the client acknowledges; data can flow both ways.

The handshake (1) agrees on starting sequence numbers and window sizes. Closing uses FIN and ACK in each direction (four segments), or RST to abort. The window says how many bytes may be sent before waiting for an acknowledgement; the receiver shrinks it when it is overwhelmed and TCP backs off when packets are lost.

Ports

PortTransportApplication
20, 21TCPFTP data, control
22TCPSSH
23TCPTelnet
25TCPSMTP
53UDP (TCP)DNS
67, 68UDPDHCP server, client
69UDPTFTP
80, 443TCPHTTP, HTTPS
123UDPNTP
161, 162UDPSNMP, SNMP traps
514UDPSyslog

Commands

netstat -anOn a host: open TCP connections and listening ports.
show tcp briefOn IOS: the device's own TCP sessions (SSH, BGP).
show control-plane host open-portsPorts IOS is listening on.

Exam traps

Check yourself

Which segments open a TCP session?
SYN, SYN-ACK, ACK.
Why does VoIP use UDP?
Low overhead and no retransmission delay: a lost voice packet is better skipped than resent late.
What does the TCP window size control?
How many bytes the sender may transmit before it must wait for an acknowledgement.

More topics in 1.0 Network Fundamentals