Every application on the network communicates using a port number and a protocol — TCP or UDP. Memorising the well-known ports (FTP, SSH, SMTP, DNS, DHCP, HTTP, HTTPS, SNMP, LDAP, RDP, SIP) is the foundation of configuring firewalls, troubleshooting connectivity, and reading packet captures. These notes follow Prof. Messer’s Network+ N10-009 videos: Introduction to IP, Common Ports, Other Useful Protocols.
⏱ Video — Introduction to IP (14:00): 0:01 intro and moving truck analogy · 1:29 encapsulation inside the ethernet frame · 3:19 tcp vs udp · 4:01 tcp — connection-oriented and reliable · 5:30 udp — connectionless and unreliable · 7:00 ip addresses and port numbers · 8:08 ip sockets · 8:50 nonephemeral and ephemeral ports · 10:06 port numbers are not security · 11:51 practical configuration example
⏱ Video — Common Ports (20:12): 0:01 intro · 0:13 ftp (20/21) · 1:12 ssh, sftp (22), and telnet (23) · 3:55 smtp (25, 587) · 5:10 dns (53) · 6:17 dhcp (67/68) and tftp (69) · 9:15 http (80) and https (443) · 10:06 ntp (123) · 11:38 snmp (161, 162) · 14:14 ldap (389, 636) · 15:31 smb (445) · 16:55 syslog (514) and ms-sql (1433) · 18:49 rdp (3389) · 19:30 sip (5060, 5061)
⏱ Video — Other Useful Protocols (8:16): 0:01 icmp · 1:22 gre (generic routing encapsulation) · 1:58 vpn concentrators · 3:10 ipsec ike and isakmp · 4:48 phase one and phase two · 5:39 transport mode vs tunnel mode · 7:12 ah vs esp
The moving truck — IP, TCP, and UDP
- IP (Internet Protocol) is the “moving truck” that carries data across the network. The network itself is the road. Inside the truck are boxes — TCP or UDP segments.
- Encapsulation: data is wrapped layer by layer. An Ethernet frame contains an Ethernet header and trailer. Inside the Ethernet payload is an IP header and IP payload. Inside the IP payload is a TCP or UDP header and its payload (e.g. HTTP data).
Ethernet header | IP header | TCP/UDP header | Application data | Ethernet trailerTCP vs UDP
| TCP | UDP | |
|---|---|---|
| Full name | Transmission Control Protocol | User Datagram Protocol |
| Connection | Connection-oriented — formal setup and teardown | Connectionless — no setup, no warning |
| Delivery | Reliable — acknowledgments, retransmission, error recovery | Unreliable — no acknowledgment, no retransmission |
| Flow control | Yes — receiver can tell sender to speed up or slow down | No — receiver never sends anything back |
| Use case | Web, email, file transfer | Voice, video, DNS queries |
- TCP: all data is acknowledged. If no ACK arrives, the sender re-sends. Packets are numbered so the receiver can request only what was lost. The receiving station can also configure flow control.
- UDP: barebones — send packet after packet with no acknowledgement, no error recovery, and no flow control. “Unreliable” does not mean less likely to arrive; it means the sender cannot guarantee delivery.
Port numbers and sockets
- A socket is the combination of an IP address, a protocol (TCP or UDP), and a port number. Both the client and the server have sockets.
- Nonephemeral ports (0–1,023): permanent, well-known port numbers assigned to servers — e.g. port 80 for HTTP, port 443 for HTTPS.
- Ephemeral ports (1,024–65,535): temporary ports assigned to the client side of a connection.
- These are conventions, not rules — a server could use an ephemeral port, but clients would then need to know the non-standard number.
- Changing a port number is not a security mechanism. Only a firewall decides whether traffic is allowed.
- TCP port numbers and UDP port numbers are independent: TCP port 80 is a different logical port from UDP port 80.
Practical example: a server at 10.0.0.2 runs a web server (TCP 80), a VoIP server (UDP 5004), and an email server (TCP 143). A client at 10.0.0.1 communicates with all three simultaneously, using a different randomised ephemeral source port for each session.
Well-known port reference
| Port | Protocol | Application |
|---|---|---|
| 20, 21/TCP | FTP | File Transfer Protocol — port 21 control, port 20 data |
| 22/TCP | SSH, SFTP | Secure Shell / secure FTP — encrypted remote console and file transfer |
| 23/TCP | Telnet | Telecommunication Network — remote console, no encryption |
| 25/TCP | SMTP | Simple Mail Transfer Protocol — server-to-server email, plain text |
| 53/UDP (TCP for transfers) | DNS | Domain Name System — translates FQDNs to IP addresses |
| 67, 68/UDP | DHCP | Dynamic Host Configuration Protocol — automatic IP configuration |
| 69/UDP | TFTP | Trivial File Transfer Protocol — no authentication, used for device config downloads |
| 80/TCP | HTTP | Hypertext Transfer Protocol — unencrypted web traffic |
| 443/TCP | HTTPS | HTTP over SSL/TLS — encrypted web traffic |
| 123/UDP | NTP | Network Time Protocol — clock synchronisation (~1 ms accuracy) |
| 161, 162/UDP | SNMP | Simple Network Management Protocol — queries (161) and traps (162) |
| 389, 636/TCP | LDAP, LDAPS | Lightweight Directory Access Protocol — directory queries (389 plain, 636 secure) |
| 445/TCP | SMB/CIFS | Server Message Block / Common Internet File System — Windows file and printer sharing |
| 514/UDP | Syslog | Log file transfer to a central collector |
| 1433/TCP | MS-SQL | Microsoft SQL Server database queries |
| 3389/TCP | RDP | Remote Desktop Protocol — view and control a remote Windows desktop |
| 5060, 5061/TCP | SIP | Session Initiation Protocol — VoIP call control (5060 plain, 5061 TLS) |
SMTP with TLS encryption commonly uses TCP port 587.
File transfer details
- FTP (TCP 20/21): generic file transfer across any OS. Supports authentication, directory listing, add, delete, rename.
- SFTP (TCP 22): secure file transfer that runs over the SSH protocol. All communication is encrypted. Same file management as FTP.
- TFTP (UDP 69): minimal transfer with no authentication. Used when a device (e.g. VoIP phone) downloads a configuration file after obtaining an IP address via DHCP.
Email and directory protocols
- SMTP (TCP 25 or 587): transfers email between servers (port 25, plain text) or from a client to a server (port 587 with TLS).
- Receiving and managing the inbox uses separate protocols: IMAP or POP3.
- LDAP uses a hierarchical structure: the root is the organisation, below are organisational units (OUs) containing common name entries for devices and users. LDAP Secure (LDAPS, TCP 636) encrypts queries.
SNMP — Simple Network Management Protocol
- SNMP (UDP 161/162) lets a management station query routers, switches, and firewalls about performance and traffic volume, then graph and report.
- v1: single query/response, no encryption.
- v2c: bulk transfers (many variables at once), still no encryption.
- v3: message integrity, authentication, and encryption.
- SNMP traps (UDP 162): devices proactively send alerts without being polled.
ICMP — Internet Control Message Protocol
- ICMP is carried by IP but does not use TCP or UDP — it is its own protocol.
- Most commonly associated with the ping command: send a message to a device and wait for a response.
- Also provides error messages: “network not reachable”, “time exceeded” (TTL expired), and similar administrative information.
GRE — Generic Routing Encapsulation
- GRE encapsulates data inside an IP packet to create a tunnel between two endpoints. GRE itself provides no encryption — additional VPN protocols are needed to protect the data.
VPN concentrators
- A VPN concentrator is an appliance (often integrated into a firewall) that provides encryption and decryption for site-to-site VPN tunnels over a public network. It can be a hardware device with specialised encryption hardware, or software for a limited number of users.
IPSec — Internet Protocol Security
- IPSec provides encryption (confidentiality), digital signatures (integrity), and anti-replay. Works across different manufacturers’ devices.
- Two primary sub-protocols:
- AH (Authentication Header) — validates data integrity, but sends everything in the clear.
- ESP (Encapsulation Security Payload) — encrypts the original data and provides authentication. Most implementations use ESP.
- IKE (Internet Key Exchange) negotiates the encryption parameters before
data flows:
- Phase 1: creates an ISAKMP tunnel over UDP port 500 using Diffie–Hellman to establish a shared secret.
- Phase 2: negotiates ciphers, key sizes, and establishes inbound and outbound Security Associations (SAs) for the ESP tunnel.
- Two modes:
- Transport mode: inserts an IPSec header between the IP header and the data; the original IP header stays in the clear.
- Tunnel mode: encrypts the entire original packet (IP header + data) and adds a new IP header pointing to the IPSec concentrator — the more secure and more common choice.
Where attacks live — mental map (beyond the video)
Not from the video — why this matters for security.
- Non-ephemeral ports are the most visible — an attacker scans them to identify running services. A port scan reveals SSH on 22, web on 80/443.
- Telnet (23) and FTP (20/21) send credentials in the clear — anyone capturing packets on the same LAN sees your login.
- SNMP v1/v2c community strings are sent in the clear; an attacker who captures them can reconfigure network devices.
- SMB (445) is a favourite target for ransomware propagation (EternalBlue class exploits); never expose it to the internet.
- Syslog (514/UDP) has no built-in encryption or authentication — an attacker on the LAN can inject false log entries to hide activity.
- IPSec in transport mode leaves the original IP header exposed, which leaks the real source and destination even though the payload is encrypted.