Ports and Protocols, Explained

What each port on the CompTIA Network+ exam actually does, how its traffic flows, and whether anyone listening in could read it. Every protocol has a diagram, a real example and an exam tip. When you're ready, test yourself with the ports flashcards.

Short on time? Skip to the patterns worth remembering.

Web

How browsers and web servers talk. HTTPS adds encryption, plus a certificate that proves the site is genuine.

HTTP

Hypertext Transfer ProtocolNetwork+
Port 80TCPNot encrypted
Your browserWeb serverTCP port 80pass=hunter2Anyone on the path can read or change it

What it's forThe language browsers and web servers use to request and send pages, images and data. Nothing is encrypted, so anyone on the path can read it or even change it. Today almost every site redirects HTTP to HTTPS.

Real exampleA page loaded over http:// shows "Not secure" in the browser's address bar.
Exam tip: Port 80 means unencrypted web traffic. Any question about securing a website points to HTTPS on 443.
Secure version: HTTPS, port 443.

HTTPS

Hypertext Transfer Protocol SecureNetwork+
Port 443TCP (HTTP/3 uses UDP)Encrypted
Your browserWeb serverTCP port 4437Fq!x9#Lm2Encrypted, and the site proves who it is

What it's forHTTP wrapped in TLS encryption. Before anything is sent, the browser checks the site's certificate to confirm it's really talking to that site. After that, pages, passwords and cookies are all encrypted.

Real exampleOnline banking loads over https://, so nobody else on the network can read your account details.
Exam tip: Port 443 means HTTPS. TLS does the encrypting; the certificate proves the server's identity.
Replaces HTTP.

HTTP vs HTTPS: what an eavesdropper sees

The same login form, captured by someone on the same Wi-Fi network.

HTTP, port 80
POST /login HTTP/1.1
Host: shop.example

user=sam&pass=hunter2
HTTPS, port 443
3f 9a c1 07 e2 5b 8d 44
b0 6e 21 f9 7c a3 58 1d
e4 92 0b 6f d7 38 aa 15
71 c8 4e 03 9d b6 2f e0

Email

Sending mail (SMTP and SMTPS) and collecting it (POP3 and IMAP). Every mail protocol has a plain original and a secure version.

SMTP

Simple Mail Transfer ProtocolNetwork+
Port 25TCPEncryption optional
Your providerTheir providerTCP port 25Subject: HiServer to server, often upgraded with STARTTLS

What it's forHow mail servers hand email to each other across the internet. When you send a message, your provider's server looks up the recipient's mail server in DNS and delivers the message to it over SMTP on port 25. Servers often upgrade the connection to an encrypted one with STARTTLS when both sides support it.

Real exampleGmail's mail servers deliver your message to the recipient's mail server over port 25.
Exam tip: SMTP only sends mail. Getting mail into your app is POP3 or IMAP.
Client version: SMTPS, port 587.

SMTPS

Simple Mail Transfer Protocol SecureNetwork+
Port 587TCPEncrypted
Your phoneYour mail serverTCP port 587x2#Rk!7vQYour app logs in and sends, encrypted

What it's forThe port your email app uses to hand a new message to your own mail server. You log in, the connection is encrypted with STARTTLS, and your server then delivers the message onward using SMTP. Network+ calls this SMTPS; port 465 (SMTP over TLS from the first byte) is also used.

Real exampleA mail app such as Thunderbird sends mail through smtp.gmail.com on port 587.
Exam tip: An email app sending mail securely uses 587. Server-to-server delivery uses 25.
Plain version: SMTP, port 25.

POP3

Post Office Protocol version 3Beyond Network+
Port 110TCPNot encrypted
Your mail appMail serverTCP port 110any new mail?3 messagesMail moves to this device, then is deleted

What it's forAn older way to collect mail: your app downloads new messages from the server and usually deletes them there, so each message ends up on one device only. Handy when mailboxes were small; confusing when you own a phone and a laptop.

Real exampleAn old email app downloads all new mail to one PC and deletes it from the server.
Exam tip: POP3 means download and delete, one device. IMAP means mail stays on the server, synced everywhere.
Secure version: POP3S, port 995. Compare with IMAP.

POP3S

POP3 over TLSBeyond Network+
Port 995TCPEncrypted
Your mail appMail serverTCP port 995k9$Wz1!pRSame as POP3, but encrypted

What it's forPOP3 inside a TLS-encrypted connection, so your password and your messages can't be read on the way.

Real exampleAn email client downloads mail from pop.gmail.com on port 995.
Exam tip: The secure mail ports sit in the 990s: 993 is IMAPS and 995 is POP3S.
Plain version: POP3, port 110.

IMAP

Internet Message Access ProtocolBeyond Network+
Port 143TCPNot encrypted
LaptopMail serverPhoneTCP port 143 to both devicesSame mailbox, in sync on every device

What it's forYour mail stays on the server and every device looks at the same mailbox. Read, flagged, deleted and sorted messages stay in sync across your phone, laptop and webmail.

Real exampleReading a message on your phone marks it as read on your laptop too, because both use IMAP.
Exam tip: IMAP keeps mail on the server and in sync. POP3 downloads it to one device.
Secure version: IMAPS, port 993. Compare with POP3.

IMAPS

IMAP over TLSBeyond Network+
Port 993TCPEncrypted
Mail appMail serverTCP port 993m4!Tq8#zLHow mail apps read mail today

What it's forIMAP encrypted with TLS. This is what phone and laptop mail apps normally use to read mail today.

Real exampleThe iPhone Mail app reads Gmail from imap.gmail.com on port 993.
Exam tip: The secure mail ports sit in the 990s: 993 is IMAPS and 995 is POP3S.
Plain version: IMAP, port 143.

How one email travels

Sam sends a message from a phone; Alex reads it on theirs. Three protocols, three ports.

SamSam's serverAlex's serverAlex58725993Send on 587, deliver on 25, read on 993
POP3 / POP3SIMAP / IMAPS
Ports110 / 995143 / 993
Where mail livesDownloaded to one deviceStays on the server
Several devicesOut of syncIn sync
Used todayRarelyAlmost always (IMAPS)

File transfer

Moving files between machines, from the ancient but still-around FTP to everyday Windows file sharing.

FTP

File Transfer ProtocolNetwork+
Ports 20/21TCPNot encrypted
Your laptopFTP serverport 21: login, commandsport 20: the file itselfBoth connections are unencrypted

What it's forOne of the oldest internet protocols. It uses two separate connections: port 21 for commands such as logging in and listing files, and port 20 for the file data itself (in active mode). Usernames, passwords and files all travel unencrypted.

Real exampleA web designer uploads site files to an old hosting server with FileZilla, connecting on port 21.
Exam tip: FTP uses two connections: 21 for control, 20 for data.
Secure replacement: SFTP, port 22.

SFTP

Secure File Transfer ProtocolNetwork+
Port 22TCPEncrypted
$ sftp_Your laptopLinux serverTCP port 22p3#Lx!8qZFiles travel inside encrypted SSH

What it's forFile transfer that runs inside an SSH connection, so it uses SSH's port 22 and SSH's encryption. Its official name is the SSH File Transfer Protocol. Despite the name, it isn't FTP with encryption added; it's a separate protocol that does the same job.

Real exampleA developer copies a backup to a Linux server with sftp user@server, which travels inside SSH.
Exam tip: SFTP shares port 22 with SSH. Don't confuse it with FTPS, which is FTP with TLS added.
Runs over SSH. Replaces FTP.

TFTP

Trivial File Transfer ProtocolNetwork+
Port 69UDPNot encrypted
SwitchTFTP serverUDP port 69firmware.binNo login and no encryption

What it's forA stripped-down file transfer with no login and no folder browsing, running over UDP. Network devices use it to load configurations and firmware, often while booting. Because anyone can use it, it should never be reachable from untrusted networks.

Real exampleA Cisco switch pulls a new firmware image from a TFTP server with copy tftp: flash:.
Exam tip: TFTP is UDP 69 with no authentication. FTP is TCP 20/21 with a login.
Compare with FTP.

SMB

Server Message BlockNetwork+
Port 445TCPEncryption optional
Windows PCFile serverTCP port 445Q3-report.xlsxNever expose port 445 to the internet

What it's forHow Windows computers share files and printers. Mapped network drives and paths like \\server\share use SMB. Modern SMB 3 can encrypt its traffic, and port 445 should never be open to the internet: several major worms spread through it.

Real exampleA Windows PC opens \\fileserver\shared to reach the team's shared network drive.
Exam tip: Windows file sharing means SMB on 445. Older NetBIOS-based sharing used 137 to 139.
Older companion: NetBIOS, ports 137 to 139.

Four ways to move a file

Same job, very different security.

FTPSFTPTFTPSMB
Port20/212269445
TransportTCPTCPUDPTCP
LoginYesYesNoneYes
EncryptedNoYesNoOptional (SMB 3)
Typical useOld web hostingAdmins, backupsDevice firmwareWindows shares

Remote access

Controlling another computer or network device from where you're sitting: a command line (SSH, Telnet) or a full desktop (RDP).

SSH

Secure ShellNetwork+
Port 22TCPEncrypted
$ ssh_Your laptopRouterTCP port 22k8#Qz!2v&9pXAnyone watching sees only scrambled data

What it's forLogging in to a server, router or switch and typing commands on it, as if you were sitting in front of it. Everything is encrypted, including your password, so it's safe to use across any network. SSH also carries SFTP file transfers and can tunnel other traffic.

Real exampleAn admin runs ssh admin@192.168.1.1 to configure a router from the command line.
Exam tip: "Secure remote command-line access" or "secure replacement for Telnet" means SSH on port 22.
Replaces Telnet. Shares port 22 with SFTP.

Telnet

Network+
Port 23TCPNot encrypted
telnet_Your laptopOld switchTCP port 23pass: cisco123Anyone watching can read your password

What it's forThe original way to get a command line on a remote device. It does the same job as SSH, but sends everything as plain text: your username, your password and every command. You'll still meet it on old equipment and in lab environments.

Real exampleAn old switch is managed with telnet 10.0.0.5, so anyone capturing the traffic can read the password.
Exam tip: If a question asks which remote access protocol is insecure or sends credentials in clear text, the answer is Telnet. The fix is always SSH.
Secure version: SSH, port 22.

RDP

Remote Desktop ProtocolNetwork+
Port 3389TCP (UDP also used)Encrypted
Your laptopWindows serverTCP port 3389keyboard and mousescreen updatesYou control the server's desktop from your laptop

What it's forUsing a Windows computer's full graphical desktop from somewhere else. Your keystrokes and mouse movements travel to the remote machine, and pictures of its screen travel back. The connection is encrypted, but port 3389 left open to the internet is a favourite target for attackers, so it's usually reached through a VPN.

Real exampleA helpdesk tech opens Remote Desktop Connection (mstsc) to work on a Windows server's desktop.
Exam tip: "Remote graphical access to a Windows machine" means RDP on 3389. Command line only? That's SSH.
Compare with SSH for command-line access.

Telnet vs SSH: what an eavesdropper sees

The same login, captured by someone on the same network with a packet sniffer.

Telnet, port 23
User Access Verification
Username: admin
Password: cisco123
Switch# show running-config
SSH, port 22
3f 9a c1 07 e2 5b 8d 44
b0 6e 21 f9 7c a3 58 1d
e4 92 0b 6f d7 38 aa 15
71 c8 4e 03 9d b6 2f e0
TelnetSSHRDP
Port23223389
You getCommand lineCommand lineFull desktop
EncryptedNoYesYes
Use it today?AvoidYesYes, behind a VPN

Names, addresses and time

The behind-the-scenes services every device needs: an IP address (DHCP), names turned into addresses (DNS, NetBIOS) and the right time (NTP).

DNS

Domain Name SystemNetwork+
Port 53TCP and UDPNot encrypted
Your laptopDNS serverUDP port 53example.com?203.0.113.10Name in, IP address out

What it's forThe internet's phone book. Your device asks a DNS server for the IP address behind a name like example.com, then connects to that address. Normal lookups use UDP; zone transfers between DNS servers and very large answers use TCP. Standard DNS isn't encrypted, which DNS over HTTPS and DNS over TLS (port 853) fix.

Real exampleTyping example.com in a browser sends a DNS query that comes back with the site's IP address.
Exam tip: DNS is one of the few protocols on the list that uses both TCP and UDP, both on port 53.
Older LAN naming: NetBIOS.

DHCP

Dynamic Host Configuration ProtocolNetwork+
Ports 67/68UDPNot encrypted
New laptopDHCP server1 Discover: any servers?2 Offer: take .503 Request: .50, please4 Acknowledge: it's yoursUDP 67 on the server, 68 on the client

What it's forHands out network settings automatically when a device joins: an IP address, subnet mask, default gateway and DNS servers. The exchange has four steps, remembered as DORA: Discover, Offer, Request, Acknowledge.

Real exampleA laptop joins the office Wi-Fi and automatically receives its IP address, gateway and DNS server.
Exam tip: The DHCP server listens on 67 and the client on 68. Remember DORA.
Next step after joining: DNS.

NTP

Network Time ProtocolNetwork+
Port 123UDPNot encrypted
RouterTime serverUDP port 123time, please?14:03:07.215Every device agrees on the time

What it's forKeeps clocks in sync across a network, usually to within a few milliseconds on a local network. Accurate time matters more than it sounds: log timestamps, Kerberos logins and certificate checks all depend on it.

Real exampleEvery router and server syncs its clock to pool.ntp.org, so log timestamps line up across devices.
Exam tip: NTP is UDP 123. Kerberos logins fail if clocks drift more than 5 minutes apart.
Needed by Kerberos.

NetBIOS

Beyond Network+
Ports 137-139TCP and UDPNot encrypted
Your PCWhole LANUDP port 137Who is OFFICE-PC?Me: 192.168.1.23A name lookup shouted to the whole LAN

What it's forAn older Windows system for naming computers on a local network and talking to them: 137 for names, 138 for datagrams, 139 for sessions. Modern Windows uses DNS and SMB on 445 instead, but NetBIOS still turns up on older networks.

Real exampleAn older Windows PC finds another computer on the LAN by its name, such as OFFICE-PC.
Exam tip: 137 to 139 means NetBIOS. Security scans often flag these ports as unnecessary.
Modern replacements: DNS and SMB.

Joining a network and opening a website

Three protocols from different groups, working in order every time you connect.

  1. DHCP, UDP 67/68. Your laptop joins the Wi-Fi and receives an IP address, gateway and DNS server.
  2. DNS, port 53. You type example.com and DNS turns it into an IP address.
  3. HTTPS, TCP 443. Your browser connects to that address and loads the page, encrypted.

Monitoring and logs

Keeping an eye on the network: reading device health (SNMP) and gathering logs in one place (Syslog).

SNMP

Simple Network Management ProtocolNetwork+
Ports 161/162UDPEncrypted only in v3
MonitoringSwitchpoll on 161: traffic?reply: 5.2 GB todaytrap to 162: port 7 downPlain-text community strings before v3

What it's forLets a monitoring system read information from network devices, such as traffic counters, CPU load and interface status. The manager polls devices on 161; devices send urgent alerts, called traps, to the manager on 162. Versions 1 and 2c use a plain-text "community string" as a password; SNMPv3 adds real authentication and encryption.

Real exampleA monitoring tool polls a switch on 161 for traffic counts, and the switch sends a trap to 162 when a link goes down.
Exam tip: Polls go to 161 and traps come back on 162. Secure SNMP means SNMPv3.
Often paired with Syslog.

Syslog

Network+
Port 514UDPNot encrypted
FirewallLog serverUDP port 514DENY 203.0.113.9Logs from every device, in one place

What it's forThe standard way for devices to send log messages to a central log server, often part of a SIEM. Each message carries a severity from 0 (emergency) to 7 (debug), so the important ones stand out.

Real exampleA firewall sends a message about every blocked connection to a central log server for later review.
Exam tip: Syslog is UDP 514. Remember the scale: 0 is the most severe, 7 is debug.
Often paired with SNMP.

SNMP vs Syslog

Both feed a monitoring system, in different ways.

SNMPSyslog
PortsUDP 161 (polls), 162 (traps)UDP 514
Who starts itManager asks, or device sends a trapDevice sends
CarriesNumbers: counters, status, loadText messages with a severity
Secure versionSNMPv3Syslog over TLS

Directory and login

Checking who you are and what you're allowed to do: directories (LDAP), Windows domain logins (Kerberos) and central AAA servers (RADIUS, TACACS+).

LDAP

Lightweight Directory Access ProtocolNetwork+
Port 389TCP (UDP also possible)Not encrypted
Web appDirectoryTCP port 389is alice in Staff?yesApps check users against the directory

What it's forA standard way to ask a directory questions. A directory is the central database of users, groups and computers, such as Microsoft Active Directory. Apps use LDAP to check logins and to see who belongs to which group. On its own it isn't encrypted; it can be upgraded with StartTLS, or replaced by LDAPS.

Real exampleA web app checks a user's password and group membership against Active Directory before letting them in.
Exam tip: LDAP is 389 and LDAPS is 636. Active Directory speaks LDAP.
Secure version: LDAPS, port 636.

LDAPS

LDAP over SSLNetwork+
Port 636TCPEncrypted
VPN applianceDomain controllerTCP port 636r7!Kx2#VwDirectory lookups, encrypted with TLS

What it's forLDAP inside a TLS-encrypted connection, so usernames, passwords and directory data can't be read in transit. The name says SSL for historical reasons; modern servers use TLS.

Real exampleA VPN appliance checks staff logins against Active Directory over an encrypted LDAPS connection.
Exam tip: LDAPS is 636, the secure version of LDAP on 389.
Plain version: LDAP, port 389.

Kerberos

Beyond Network+
Port 88TCP and UDPEncrypted
Domain controllerYouFile server1. get a ticketport 882. show the ticketYour password never reaches the file server

What it's forThe login system behind Windows domains. You prove who you are once to the domain controller and receive a ticket. You then show tickets to reach file servers and other services, so your password never has to travel to them.

Real exampleLogging in to a domain-joined Windows PC gets you a Kerberos ticket from the domain controller.
Exam tip: Kerberos uses tickets on port 88 and needs clocks in sync, which is NTP's job.
Depends on NTP. Directory lookups use LDAP.

RADIUS

Remote Authentication Dial-In User ServiceBeyond Network+
Ports 1812/1813UDPEncrypts passwords only
Your laptopAccess pointRADIUS serverUDP 1812logincheckacceptWi-Fi logins checked in one central place

What it's forCentral authentication, authorization and accounting (AAA) for network access. A Wi-Fi access point or VPN gateway passes your login to the RADIUS server, which says yes or no and keeps a record of the session. Only the password is encrypted.

Real exampleJoining company Wi-Fi with your work username (WPA2-Enterprise) sends your login to a RADIUS server.
Exam tip: RADIUS: UDP, network access, encrypts only the password. TACACS+: TCP, device administration, encrypts the entire payload.
Compare with TACACS+.

TACACS+

Terminal Access Controller Access-Control System PlusBeyond Network+
Port 49TCPEncrypted
$ _AdminRouterTACACS+TCP 49loginallowed?yesEvery admin command can be approved

What it's forAAA for administrators logging in to routers, switches and firewalls. It handles authentication and authorization separately, so it can control exactly which commands each admin may run, and it encrypts the entire payload of every packet, not just the password. It was developed by Cisco.

Real exampleAn engineer logs in to a Cisco router, and the router asks a TACACS+ server which commands they're allowed to run.
Exam tip: TACACS+ is TCP 49, used for device administration, and encrypts the entire payload.
Compare with RADIUS.

RADIUS vs TACACS+

Both are central AAA servers, and a favourite exam comparison.

RADIUSTACACS+
PortsUDP 1812, 1813TCP 49
Main useNetwork access (Wi-Fi, VPN)Admin logins to devices
EncryptionPassword onlyEntire payload
Authentication and authorizationCombinedSeparate
OriginOpen standardCisco

Voice

Setting up phone and video calls over the network.

SIP

Session Initiation ProtocolNetwork+
Ports 5060/5061TCP and UDPEncrypted on 5061
Your phonePhone systemTheir phoneSIP: 5060, or 5061 with TLScallringyour voice (RTP)SIP sets up the call; RTP carries the voice

What it's forSets up, manages and ends voice and video calls; it's the "dialling" part of VoIP. The voice itself travels separately, usually over RTP. SIP uses 5060 without encryption and 5061 with TLS.

Real exampleAn office desk phone registers with the company's VoIP system and uses SIP to set up each call.
Exam tip: SIP signals the call on 5060/5061; RTP carries the audio.

Databases

Database servers that apps connect to. These ports should never face the internet.

SQL Server

Microsoft SQL ServerNetwork+
Port 1433TCPEncryption optional
App serverSQL ServerTCP port 1433SELECT * FROM...42 rowsOnly app servers should reach 1433

What it's forMicrosoft's database server. Apps connect on 1433 to read and write data. The database should sit behind a firewall that lets in only the app servers that need it.

Real exampleA company's accounting app reads and writes its data on a Microsoft SQL Server database on 1433.
Exam tip: 1433 is Microsoft SQL Server; 3306 is MySQL.
Compare with MySQL.

MySQL

Beyond Network+
Port 3306TCPEncryption optional
WordPress siteMySQLTCP port 3306latest posts?10 postsDatabases belong behind a firewall

What it's forA popular open-source database, used by WordPress and countless other web apps. Like any database port, 3306 should only be reachable from the servers that need it.

Real exampleA WordPress site stores its posts and user accounts in a MySQL database on port 3306.
Exam tip: 3306 is MySQL; 1433 is Microsoft SQL Server.
Compare with SQL Server.

VPN and routing

Setting up VPN tunnels between sites or from home (IKE, L2TP), and exchanging routes between the networks that make up the internet (BGP).

IKE

Internet Key ExchangeBeyond Network+
Port 500UDPEncrypted
Office AOffice BUDP 500: agree on keysencrypted IPsec tunnelIKE sets up the tunnel; IPsec carries data

What it's forThe first step of an IPsec VPN: the two ends prove who they are and agree on encryption keys. After that, the actual data travels through the encrypted IPsec tunnel. If NAT is in the way, IKE switches to UDP 4500.

Real exampleBefore a site-to-site VPN carries any traffic, the two firewalls use IKE to agree on encryption keys.
Exam tip: Setting up IPsec means IKE on UDP 500, or 4500 through NAT.
Often paired with L2TP.

L2TP

Layer 2 Tunneling ProtocolBeyond Network+
Port 1701UDPNot encrypted alone
Your laptopVPN gatewayUDP port 1701L2TP inside IPsecL2TP alone does not encrypt anything

What it's forBuilds a VPN tunnel but provides no encryption of its own, so it's almost always paired with IPsec, written L2TP/IPsec. IPsec does the encrypting; L2TP does the tunnelling.

Real exampleA Windows laptop connects to the office with the built-in L2TP/IPsec VPN option.
Exam tip: L2TP is UDP 1701 and relies on IPsec for encryption.
Encryption comes from IPsec, set up by IKE.

BGP

Border Gateway ProtocolBeyond Network+
Port 179TCPNot encrypted
ISP AISP BTCP port 179I reach 203.0.113.0/24I reach 198.51.100.0/24Each network shares the routes it can reach

What it's forThe routing protocol of the internet. Internet providers, cloud companies and large organisations each run a network called an autonomous system, and use BGP to tell each other which blocks of IP addresses they can reach, so traffic can find its way across the world.

Real exampleAn internet provider uses BGP to tell the rest of the internet which IP address blocks it can reach.
Exam tip: BGP is TCP 179 and routes between organisations: it's the exterior gateway protocol.

Patterns worth remembering

  • The low 20s hold the classics: 20/21 FTP, 22 SSH, 23 Telnet, 25 SMTP.
  • Secure mail lives in the 990s: 993 IMAPS and 995 POP3S.
  • Pairs that come as a set: 20/21 FTP, 67/68 DHCP, 161/162 SNMP, 1812/1813 RADIUS, 5060/5061 SIP.
  • The UDP crowd: DHCP, TFTP, NTP, SNMP, Syslog, RADIUS, IKE and L2TP use UDP. DNS, Kerberos, SIP and NetBIOS use both.
  • Secure versions: Telnet to SSH, HTTP to HTTPS, FTP to SFTP, LDAP to LDAPS, POP3 to POP3S, IMAP to IMAPS, SNMP to SNMPv3.
Practice with the flashcards