What is a port?¶
title: "What is a port?" card_id: "IP-097" status: "complete" source_document: "https://docs.google.com/document/d/1lQ0HYy9ZoAugg9mXa-m7TWcWXvG-lCNR13wCC85cWS8/edit?usp=drivesdk"
What is a port?¶
An IP address helps data reach the correct device or system.
A port number helps that system deliver the data to the correct application or network service.
One device can be doing several things across a network at the same time.
It might be loading a webpage.
Sending an email.
Streaming music.
Receiving messages.
And downloading a software update.
Those communications may all use the same IP address.
The device needs a way to keep them separate.
That is where port numbers come in.
Most common application traffic uses transport protocols called TCP or UDP.
Both TCP and UDP use port numbers ranging from zero to 65535.
A port number is normally written alongside an IP address.
For example:
203.0.113.10, port 443.
Or it may be written with a colon:
203.0.113.10 colon 443.
The IP address identifies the system involved.
The port number identifies a particular communication point on that system.
Applications providing network services can listen for incoming traffic on particular ports.
For example, a web server providing HTTPS commonly listens on port 443.
When a browser connects to it, the destination might therefore be:
203.0.113.10, destination port 443.
The browser also uses a port at its own end of the connection.
That is the source port.
The source port helps the device keep track of the communication and ensures that replies are returned to the correct application or connection.
So a network communication will often contain:
A source IP address.
A source port.
A destination IP address.
And a destination port.
The destination port is where the traffic is being sent.
The source port is where that particular communication came from at the sending end.
The source and destination labels depend on the direction of the traffic.
When the other system replies, the values appear in the opposite positions.
Some ports are commonly associated with particular services.
Port 443 is commonly used for HTTPS.
Port 80 is commonly used for ordinary HTTP web traffic.
Port 53 is commonly used for DNS.
But a port number doesn’t guarantee that a particular application or type of content was involved.
Software can be configured to use different ports.
And a service can use a familiar port for something unexpected.
Treat the port as information about how the communication was organised—not proof of what the traffic contained.
A port also doesn’t identify a person.
It isn’t permanently assigned to one user or device.
Many devices can use the same port numbers at the same time because they have different IP addresses or are involved in different communications.
Some source ports are also temporary and may be reused after a connection ends.
Not every type of network traffic uses ports.
Ports are mainly associated with transport protocols such as TCP and UDP.
Other network protocols may identify and organise their traffic differently.
For now, remember the basic distinction:
The IP address helps get the traffic to the right system.
The port number helps the system get it to the right application or communication.
Once that makes sense, we can look separately at why a recorded source port can become important when several customers share the same public IP address.