Course contents

Unit 7: TCP, UDP and PortsLesson 7.2.2 (13 of 23 in this unit)62 of 104 in the Network Fundamentals course

Common ports to know

A rule allows port 53, but DNS still fails sometimes. Did it allow TCP, UDP or both? Let's learn service defaults with their transport and a concrete troubleshooting question.

Beginner · 5 min read

Covers Well-known ports and TCP vs. UDP services.

Technical definition

A well-known port is a port in the IANA System Ports range, 0–1023. Many standard services have assignments there, such as SSH at TCP 22; not every number is assigned and port 0 is reserved. A common default such as RDP 3389 is outside this well-known range.

Three tickets that come down to port numbers

A firewall rule says "permit TCP to port 22, deny everything else". A help desk ticket says "users cannot reach the server on 3389". A packet capture shows a lot of traffic on UDP 53. To understand any of these quickly, you need to know which service uses which port.

Where the client knocks: the well-known port

Read each entry as a service, transport and port together. SSH normally listens on TCP 22. Classic DNS supports both UDP 53 and TCP 53; TCP is not restricted to zone transfers. HTTPS can use TCP 443 for HTTP/1.1 or HTTP/2 and UDP 443 for HTTP/3 over QUIC. The service's configuration, not the number alone, decides what is actually listening.

A familiar port number suggests a service; it does not prove the application is present, secure or authorised. Port 443 alone does not prove that a certificate is valid. Use the registry to understand the default, then verify the listener, protocol and application response. Changing SSH's listening port can change noise in logs, but it does not replace authentication and access control.

A default service port gives clients a conventional place to connect. Many such defaults are in the well-known 0–1023 range, while others are in the User Ports range. The client still needs the correct transport, address and actual service configuration. Some services support both TCP and UDP.

Default ports are a convention, not a law. An administrator can move SSH or RDP to another port, and when that happens the firewall rules have to follow, or the service seems to vanish.

Diagram
One client, many services
One client, many services
Admin PCIP 10.1.1.50Core switchR1SSH 22DNSUDP 53NTPUDP 123

Device key: Admin PC (computer) · Core switch (Layer 3 switch) · R1 (router) · DNS, NTP (server)

Lines show the example’s network connections. The coloured path and envelope follow the current step; its text identifies the sender, receiver and traffic type.

Reading the addresses

IP labels identify interfaces or destinations. Subnet labels identify networks; /n is the prefix length. A router ID (RID) identifies a routing process and need not be a reachable interface.

An IP address alone is not a URL. A web URL includes a scheme such as https://; an address on a router or printer does not imply a website.

  • Admin PC: IP 10.1.1.50
  • R1: SSH 22
  • DNS: UDP 53
  • NTP: UDP 123
  1. 1. SSH to the router. Every character of a login session must arrive complete and in order, so SSH uses TCP.
  2. 2. DNS lookup. This example query and answer use UDP 53. Classic DNS also supports TCP 53; a firewall must not assume that only UDP can carry a query.
  3. 3. Time check. NTP sends small, regular time requests over UDP. A delayed answer gives a less accurate time sample, so there is no point resending; the client simply asks again later.

Fifteen ports worth memorising

PortServiceTransportUsed for
20, 21FTP (data, control)TCPFile transfer
22SSHTCPSecure remote login; also SCP and SFTP
23TelnetTCPRemote login with no encryption
25SMTPTCPSending email between servers
53DNSUDP and TCPClassic DNS queries can use either; TCP also supports zone transfers
67, 68DHCP (server, client)UDPHanding out IP addresses
69TFTPUDPSimple file transfer, e.g. IOS images and configs
80HTTPTCPWeb pages without encryption
110POP3TCPDownloading email
123NTPUDPTime synchronisation
143IMAPTCPReading email kept on the server
161, 162SNMP (queries, traps)UDPMonitoring network devices
443HTTPSTCP (and UDP for HTTP/3)Encrypted web pages
514SyslogUDPSending log messages to a server
3389RDPTCP (and UDP)Windows remote desktop

Memory aid: several ports come in order. FTP is 20/21, then SSH 22, Telnet 23 and SMTP 25. DHCP is 67/68, then TFTP 69. SNMP is 161/162.

Whole files over TCP, short messages over UDP

The choice depends on the job. Services that move files, web pages or login sessions need every byte, so they use TCP. Services that send small, quick messages (DNS, DHCP, NTP, SNMP, syslog) use UDP. Each message usually fits in one datagram, and if it is lost, the application simply asks again or sends the next one.

DHCP has one more reason to use UDP. A new client has no IP address yet, so it has to broadcast its request. A TCP handshake needs a known address at each end, so it cannot work with a broadcast. UDP can.

Listing a router's open ports

A Cisco device can show which ports it is listening on itself. The output below is based on Cisco documentation, not captured from a lab device.

Example output · based on Cisco documentation; exact format varies by platform and software version
R1#show control-plane host open-ports
Active internet connections (servers and established)
Prot        Local Address      Foreign Address                  Service    State
 tcp                 *:22                  *:0               SSH-Server   LISTEN
 tcp                 *:23                  *:0                   Telnet   LISTEN
 udp                *:123                  *:0                      NTP   LISTEN
 udp                *:161                  *:0                  IP SNMP   LISTEN
 udp                *:162                  *:0                  IP SNMP   LISTEN
What to look for: the Prot, Local Address and State columns. This router is listening for SSH (TCP 22) and Telnet (TCP 23), and for NTP (UDP 123) and SNMP (UDP 161 and 162). Telnet sends everything unencrypted, so seeing it here is a sign that you should disable it and use only SSH.

Test yourself: which traffic gets through?

Predict · scenario 1

You are copying an IOS image from a TFTP server, but a firewall is in the way. Which port and protocol must the firewall allow to the TFTP server?

Predict · scenario 2

A firewall allows only TCP 443 out to the internet. Which of these connections can still leave the network?

Predict · scenario 3

A new laptop joins the network and needs an IP address. Why does DHCP use UDP for this instead of TCP?

Technical references

RFC 6335: port ranges and assignment; IANA service/port registry; RFC 7766: DNS over TCP.