📚

CCNA Layer 4 Protocols: TCP and UDP

May 7, 2025

Jeremy's IT Lab - CCNA Course Lecture Notes

Introduction

  • Free complete course for CCNA presented by Jeremy.
  • Subscribe, like, comment, and share to support the series.
  • Today's focus: TCP and UDP (Layer 4 protocols).

Overview of Layer 4

  • Previous layers covered: 1 (cables), 2 (MAC addresses, switching), 3 (IP addresses, routing).
  • Layer 4 provides transparent data transfer between end hosts.
  • It encapsulates data with a Layer 4 header and uses lower layers to deliver data unchanged.

Functions of Layer 4 Protocols

  • Transparent Data Transfer: Hosts unaware of underlying network details.

  • Services Provided by TCP:

    • Reliable data transfer: Ensures all data is received.
    • Error recovery: Resends data if errors occur.
    • Data sequencing: Organizes data in order.
    • Flow control: Manages data traffic to avoid overwhelming hosts.
  • Layer 4 Addressing: Uses port numbers to identify application protocols and manage sessions.

  • Sessions: An exchange of data between devices, allowing multiple connections simultaneously.

Port Numbers

  • Well-known Ports (0-1023): Major protocols like HTTP, FTP.
  • Registered Ports (1024-49151): Less strict registration for use.
  • Ephemeral Ports (49152-65535): Used for random source port selection.

TCP (Transmission Control Protocol)

  • Connection-oriented protocol: Establishes a connection before sending data.
  • Key Features:
    • Reliable communication: Acknowledges each TCP segment.
    • Sequencing: Uses sequence numbers for proper order.
    • Flow control: Adjusts data transmission rate via window size field.

TCP Header Overview

  • Key fields: Source/Destination ports, Sequence number, Acknowledgment number, Window Size.
  • Flags: Important for establishing (SYN, ACK) and terminating (FIN, ACK) connections.

TCP Connection Establishment (Three-Way Handshake)

  1. PC1 sends SYN to SRV1.
  2. SRV1 responds with SYN-ACK.
  3. PC1 sends ACK.
  • TCP Connection Termination (Four-Way Handshake):
    1. PC1 sends FIN.
    2. SRV1 responds with ACK.
    3. SRV1 sends FIN.
    4. PC1 sends ACK.

TCP Reliability

  • Acknowledgment and retransmission of lost segments.
  • Forward Acknowledgment: Specifies the next expected segment number.
  • Sliding Window: Adjusts data flow control dynamically.

UDP (User Datagram Protocol)

  • Connectionless Protocol: Sends data without establishing a connection.
  • Key Features:
    • No reliable communication or acknowledgments.
    • No sequencing, flow control, or error recovery.
  • UDP Header: Contains four fields (Source/Destination ports, Length, Checksum).

Comparison: TCP vs. UDP

  • TCP: Reliable, connection-oriented, larger overhead.
  • UDP: Faster, lower overhead, no guarantees of delivery.
  • Use Cases:
    • TCP: File downloads, email (SMTP).
    • UDP: Real-time applications (VoIP, video calls).

Important Protocols and Port Numbers

  • TCP Protocols:

    • FTP: 20, 21
    • SSH: 22
    • Telnet: 23
    • SMTP: 25
    • HTTP: 80
    • POP3: 110
    • HTTPS: 443
  • UDP Protocols:

    • DHCP: 67, 68
    • TFTP: 69
    • SNMP: 161, 162
    • Syslog: 514
    • DNS: Uses both TCP and UDP.

Review of Key Points

  • Layer 4 provides services and addressing via port numbers.
  • TCP is reliable and connection-oriented; UDP is simpler and faster.
  • Memorization of key port numbers essential for CCNA.

Quiz Questions Overview

  1. Recognize well-known port numbers (0-1023).
  2. Source port range for random selections (ephemeral).
  3. Features unique to TCP vs. UDP.
  4. Application Layer protocols using TCP.
  5. Acknowledgment values in TCP communication.

Additional Resources

  • Anki flashcard deck for port numbers.
  • Upcoming Wireshark demo for practical understanding.

Conclusion

  • Appreciation for channel members.
  • Encouragement to subscribe, like, and share.