Source Ports: The Number Changes Roles When the Reply Returns
A source port is the number identifying the sending endpoint in a TCP or UDP message. A port is a numbered communication endpoint used by software, and a packet is a small unit of network data. The source port helps describe where that packet came from.
The other number is the destination port, which identifies the receiving endpoint. TCP (Transmission Control Protocol) and UDP (User Datagram Protocol) are transport protocols: sets of rules for communication between programs. Their messages carry port information alongside the data.
“Source” belongs to the direction of this particular message. When the other computer replies, its port becomes the source.
- Give every phone, laptop and TV a steadier connection with Wi-Fi 6.
- Stop the buffering at busy hours, with room for many devices at once.
- Replace an aging router and get stronger coverage across more of your home.
Follow the numbers on the return trip
Suppose a client program starts a TCP connection using temporary port 53012, and the server it contacts uses port 443.
| Direction | Source port | Destination port |
|---|---|---|
| Client to server | 53012 | 443 |
| Server to client | 443 | 53012 |
The reply hasn't created a new meaning for either number. It has reversed which endpoint is sending. The client's original source port is now where the returning data is directed.
That temporary client number is called an ephemeral port. A high number in a network log can therefore be part of ordinary client communication. It doesn't necessarily mean a new service has appeared on the computer.
The port isn't newly assigned for every packet. Packets in the same TCP connection belong to the same pair of endpoints. The TCP specification defines separate source and destination fields, each 16 bits long. A bit is one binary digit, a zero or one; that field size allows numbers from 0 through 65535, though some values are reserved or restricted.
What Do Port Numbers Actually Do?
UDP also has a source-port field. Its base specification describes using it for a reply when appropriate. The same directional idea applies even though UDP handles individual messages rather than TCP's connected stream.
One number leaves out most of the address
Port 53012 alone doesn't identify one computer, one person or even one complete conversation. Other computers can use the same number.
An Internet Protocol (IP) address identifies a network location. To identify a transport conversation, the context includes the protocol and the address and port at each end. For TCP, the two address-and-port combinations form a socket pair.
The guidance on temporary port selection uses this complete combination to distinguish communication instances. One application can have multiple conversations; it doesn't have to own one permanent source number.
This is why an unfamiliar source port needs context before it tells an investigator anything useful. Start with the direction and both endpoints. The same 443 that was a destination a moment ago may simply be the website answering.
Ephemeral Ports: Why That Web Connection Uses Port 52744

Socket Pair: The Two Ends of a Connection

Network Address Translation: The Address Changes Midjourney

QUOTE:
"Amateurs hack systems, professionals hack people."
