- Common Networking Port Numbers in Linux
- What’s a Network Port?
- Transport Protocols
- TCP
- UDP
- Common Networking Ports
- FTP — 21
- SSH — 22
- TELNET — 23
- SMTP — 25
- DNS — 53
- DHCP — 67,68
- HTTP — 80
- POP3 — 110
- Portmapper — 111
- NTP — 123
- NetBIOS — 137
- IMAP — 143
- SNMP — 161, 162
- HTTPS — 443
- IMAP over SSL — 993
- Final Words
- Linux Port numbers
- Q. What is a port?
- Q. What is hardware port?
- Q. What is a socket?
- Q. What is the range of ports or how many ports are there?
- Q. Why port numbers are just 65536?
- Q. What are the well-known ports or assigned ports or default ports?
- Q. What do you mean by default port?
- Q. Can we change default port for a service(example Apache, squid)?
- Q. What are the protocol numbers for TCP and UDP?
- Q. Is there any way I can see all the port information in Linux?
- Q. How can I see open ports in Linux?
- Well known ports
- Surendra Anne
- Latest posts by Surendra Anne (see all)
Common Networking Port Numbers in Linux
Here are the common networking ports you’ll encounter in Linux.
While using a computer or smartphone, we use various hardware ports such as 3.5mm for audio, HDMI, Type-c, etc. which are used to communicate with hardware peripherals.
Similarly, networking ports serve the same purpose by enabling us to access various networking services on a single computer. So even if you are an IT student or want to start a carrier in networks, ports are considered one of the most basic and foundational terms.
So through this article, I will walk you through some basics of networking ports, the range of ports, and some of the most common ports to get started with.
What’s a Network Port?
So if you want to receive a letter from someone, you have to install a letter box at your place which is essential for receiving letters.
And computers work in the same way. The letter can be considered here as application data that you need to receive and the letterbox is the port number for that application.
But your computer is not bound to use only one application service, and we use multiple services at one time in the background, this is the reason why we need multiple port numbers which range from 0 to 65535.
These port numbers are divided into 3 ranges as per use case:
- Well-known ports (0-1023): These ports are also known as system ports, which are assigned to specific services by IANA (Internet Assigned Numbers Authority).
- Registered ports (1023-49151): These ports are known as user ports and are available for registration IANA. The reason behind registration is to avoid clashes between ports.
- Dynamic ports (49152-65535): A dynamic port can be assigned to service for a certain amount of time and is mainly used by client programs.
Transport Protocols
So what do I mean by transport protocol? In most basic terms, transport protocols are responsible for establishing connections and ensuring your data has been transported with no errors.
So mainly, there are 2 types of protocols which we generally use:
TCP
It stands for Transmission Control Protocol and is a connection-oriented protocol, which means once you establish the connection using it, data can be transmitted in two directions.
TCP has a built-in mechanism that guarantees the error-less delivery of data. This makes it ideal for sending images, data, web pages, videos, etc.
UDP
It stands for User Datagram Protocol, which is much simpler compared to TCP and does not include error-checking and recovery services.
It is faster compared to TCP and not ideal for sending data such as images, videos, etc., and has support for broadcasting. This is mostly used in video conferencing, streaming, DNS, VoIP, etc.
Common Networking Ports
It’s always a good thing to know the most commonly used ports. While scanning for open ports, you can make a decision whether or not that port is required.
FTP — 21
So, port 21 is used for FTP (File Transfer Protocol). The major use case of FTP is to exchange files between client and server.
By default, FTP does not include encryption for files being sent over the established connections and is often considered a risk.
SSH — 22
SSH (Secure Shell) is widely used by advanced users or system admins to access remote computers. But you can also use SSH for the transmission of data over the network.
SSH uses cryptographic techniques which ensure that the connection between a remote server and your computer is encrypted.
TELNET — 23
TELNET stands for TErminaL NETwork. It is used to connect computers over the internet or local computers and provides bidirectional interactive text-oriented communication.
TELNET does not provide any kind of encryption, and this is the major reason why it is only used to connect local machines.
SMTP — 25
Simple Mail Transfer Protocol (SMTP) is used to send messages, but can not receive them because it can’t queue messages at the receiver point.
So it is often paired with other protocols such as POP3 or IMAP for receiving messages.
DNS — 53
This is one of my personal favorites, as it turns the domain name into an IP address. So you may write any keyword in your search bar and don’t have to remember the IP address for each site.
DNS uses TCP and UDP at port no 53, but by default, it uses UDP and will only switch to TCP when it can’t communicate using UDP.
DHCP — 67,68
Dynamic Host Configuration Protocol (DHCP) is mainly used to assign dynamic IP addresses to computers. It also provides other network addresses such as subnet masks, default gateway, and DNS addresses.
It uses two UDP ports: 67 and 68. Port no 67 is used by servers, whereas 68 is used by clients.
HTTP — 80
You might be familiar with the name HTTP (Hyper Text Transfer Protocol) which is used to transfer data over the web and also defines how browsers are going to interact with websites.
In simple words, we use HTTP for sending and receiving page requests from the web server.
POP3 — 110
As I mentioned earlier, POP3 (Post Office Protocol version 3) is mainly used to receive mail from the remote server or local computer.
Portmapper — 111
Portmapper service is built on top of RPC, and it is required to run NFS on both client and server-side. As it is built over RPC, it runs on port no 111 for both TCP and UDP.
NTP — 123
Network Time Protocol (NTP) is one of the oldest yet crucial for running servers. It is built over UDP and uses port no 123.
The reason why NTP is crucial is that it is used to synchronize time and having synchronized time is not just convenient but crucial for running various applications.
NetBIOS — 137
Network Basic Input/Output System (NetBIOS) is a network service that enables applications of various computers to communicate with each other over a local network.
IMAP — 143
Internet Message Access Protocol (IMAP) is by default a non-encrypted port that allows you to access your emails from any device.
IMAP allows you to read your messages, but does not allow you to download or store them locally by default.
SNMP — 161, 162
Simple Network Management Protocol (SNMP) is a collection of network monitoring protocols.
It is mainly used for monitoring firewalls, servers, switches, and other network devices
HTTPS — 443
Hyper Text Transfer Protocol Secure (HTTPS) as its name suggests, is the secure version of HTTP. It is the primary protocol for sending data between web browsers and websites.
It provides strong encryption and is trusted and used by millions of users worldwide.
IMAP over SSL — 993
You can consider this as a more secure version of IMAP, as IMAP traffic will traverse through a secure socket to a secure port.
When we use active encryption, it uses a 993 port and assures us of security and privacy over the internet.
You can also refer to the given table that includes the most common ports with port no. and the protocol it uses:
Port No | Port | Protocol |
---|---|---|
21 | FTP | TCP |
22 | SSH | TCP |
23 | TELNET | TCP |
25 | SMTP | TCP |
53 | DNS | TCP, UDP |
67,68 | DHCP | UDP |
80 | HTTP | TCP |
110 | POP3 | TCP |
111 | Portmapper | TCP, UDP |
123 | NTP | UDP |
137 | NetBIOS | TCP, UDP |
143 | IMAP | TCP, UDP |
161,162 | SNMP | UDP |
443 | HTTPS | TCP |
Final Words
Having a basic knowledge of ports is one of the most crucial things to have a grasp on, and through this article, we compiled what are the commonly used ports on a day-to-day basis with a basic explanation.
Linux Port numbers
This is bit important post on understanding the ports, their details and numbers.
Some FAQ related PORTS
Q. What is a port?
A port is piece of software which is used as docking point in your machine, where remote application can communicate. This is analogy to the physical ports for entering in to a country from different sea ports.
Q. What is hardware port?
This is a physical peripheral connecting point to a machine from a physical device.
Q. What is a socket?
Socket is combination of software Port and IP address.
Q. What is the range of ports or how many ports are there?
Port numbers can vary from 0 to 65535, so total we can get 65536 ports
Q. Why port numbers are just 65536?
This is because limitation in TCP/IP stack where the port number field is just 16bit size. So we get only 2^16(2 to the power of 16) ports which are equal to 65536 available ports
Q. What are the well-known ports or assigned ports or default ports?
Well known ports are from 0 to 1023(total 2^10=1024 ports)
Q. What do you mean by default port?
Default port is a designated port for particular well-known service such as web server, mail server, ftp server etc. By default FTP uses 21 port, DNS uses 53 and Apache uses 80 port.
Q. Can we change default port for a service(example Apache, squid)?
Yes, we can change. In Apache and DNS we can change this using listen configuration entry in httpd.conf and named.conf. Squid have port entry in it’s squid.conf file to mention port number.
Q. What are the protocol numbers for TCP and UDP?
Do not confuse this one with port numbers. TCP and UDP have their own numbers in TCP/IP stack.
TCP protocol number: 6
UDP protocol number: 17
Q. Is there any way I can see all the port information in Linux?
Yes, you can get that from /etc/services files.
Q. How can I see open ports in Linux?
Well known ports
20 – FTP Data (For transferring FTP data)
21 – FTP Control (For starting FTP connection)
22 – SSH (For secure remote administration which uses SSL to encrypt the transmission)
23 – Telnet (For insecure remote administration)
25 – SMTP (Mail Transfer Agent for e-mail server such as SEND mail)
53 – DNS (Special service which uses both TCP and UDP)
69 – TFTP (Trivial file transfer protocol uses udp protocol for connection less transmission of data)
80 – HTTP/WWW(Apache)
88 – Kerberos
110 – POP3 (Mail delivery Agent)
123 – NTP (Network time protocol used for time syncing uses UDP protocol)
137 – NetBIOS (nmbd)
139 – SMB-Samba (smbd)
161 – SNMP (For network monitoring)
389 – LDAP (For centralized administration)
443 – HTTPS (HTTP+SSL for secure web access)
514 – Syslogd (udp port)
636 – ldaps (both ctp and udp)
989 – FTPS-data
2049 – NFS (nfsd, rpc.nfsd, rpc, portmap)
2401 – CVS server
3306 – MySql
6000-6063-X11
Note 1: If protocol(TCP or UDP) is not mention then the above port are solely for TCP. Some service use UDP as mention in above list.
Note 2: X11 use 6000 to 6063.. ports for connecting X11 from remote server.
Surendra Anne
Mr Surendra Anne is from Vijayawada, Andhra Pradesh, India. He is a Linux/Open source supporter who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. He works as Devops Engineer with Taggle systems, an IOT automatic water metering company, Sydney . You can contact him at surendra (@) linuxnix dot com.
Latest posts by Surendra Anne (see all)
- Docker: How to copy files to/from docker container — June 30, 2020
- Anisble: ERROR! unexpected parameter type in action: Fix — June 29, 2020
- FREE: JOIN OUR DEVOPS TELEGRAM GROUPS — August 2, 2019
- Review: Whizlabs Practice Tests for AWS Certified Solutions Architect Professional (CSAP) — August 27, 2018
- How to use ohai/chef-shell to get node attributes — July 19, 2018