Sub topic 5
Common Protocols and the Ports They Use
This chapter assumes you know what a port number is and the difference between TCP and UDP. Here you group the protocols the exam tests by job, and learn the details that cause wrong answers.
Grouping Protocols by Job
Memorize ports in groups. Each group answers one question: what is this traffic for?
| Job | Protocol | Port | Transport |
|---|---|---|---|
| Web | HTTP | 80 | TCP |
| Web | HTTPS | 443 | TCP |
| Remote access | SSH / SFTP | 22 | TCP |
| Remote access | Telnet | 23 | TCP |
| Remote access | RDP | 3389 | TCP/UDP |
| File transfer | FTP | 20 (data), 21 (control) | TCP |
| File transfer | TFTP | 69 | UDP |
| File sharing | SMB over TCP | 445 | TCP |
| Email sending | SMTP | 25 | TCP |
| Email retrieval | POP3 | 110 | TCP |
| Email retrieval | IMAP | 143 | TCP |
| Addressing | DHCP | 67 (server), 68 (client) | UDP |
| Names | DNS | 53 | TCP/UDP |
| Directory | LDAP | 389 | TCP/UDP |
| Management | SNMP | 161 (queries), 162 (traps) | UDP |
Details That Cause Wrong Answers
Secure and insecure pairs
Telnet and SSH both give a remote command line. Telnet (port 23) sends everything, including passwords, as plain text. SSH (port 22) encrypts the session. FTP is also plain text. SFTP runs inside SSH, so it uses port 22, not 21.
HTTP and HTTPS both carry web traffic. HTTPS adds TLS encryption on port 443.
POP3 versus IMAP
POP3 usually downloads mail to one device. IMAP keeps mail on the server, so several devices see the same mailbox. SMTP only sends mail. If a user can receive mail but cannot send it, suspect SMTP. If the user can send but not receive, suspect POP3 or IMAP.
Ports with more than one entry
- FTP uses two ports. Port 21 carries commands, and port 20 carries data.
- DHCP uses two ports. The client listens on 68, and the server listens on 67.
- NetBIOS/NetBT uses 137-139 on older Windows file sharing. Modern SMB uses 445 directly.
- DNS normally uses UDP for small queries and TCP for large replies and zone transfers.
Choosing UDP
TFTP, DHCP and SNMP use UDP because they are short, simple exchanges. TFTP has no login and no directory listing, so it suits small jobs such as loading firmware on a network device.
Checking Ports on Your Own Computer
Use netstat to see which ports are in use. The -a option shows all connections and listening ports, and -n shows numbers instead of names.
netstat -anA line showing 0.0.0.0:3389 in the LISTENING state means Remote Desktop is accepting connections.
Exercise
A user can open web pages and receive email in their mail client, but every message they send fails. Which protocol and port should you check first?
Show answer
SMTP on port 25. SMTP handles sending mail. Receiving works, so POP3 (110) or IMAP (143) is not the problem.
Exercise
A technician must manage a remote server's command line over an untrusted network. Which protocol and port should they choose, and why not Telnet?
Show answer
SSH on port 22. Telnet (port 23) sends passwords in plain text, while SSH encrypts the session.