Tutorial: What is a Port?

The term "port" crops up in IP networking, particularly in the context of rules in routers and software firewalls.

One hears about "opening a port on a firewall" and "TCP ports" and "UDP ports".

So just what is a "port", exactly?

Like about 40% of the words in English after the Norman invasion of southern England following the Battle of Hastings in 1066, the English word "port" is French. Une porte is a door.

Of course, the French got it from Latin: porta (gate, door). The Latin word portus (port, harbor, and earlier, entrance, passage) and the Greek word poros (journey, passage, way), and the English word pore are obviously related.

In the computer hardware business, a port is a doorway into the machine: a jack, where a cable can be connected. In days past, there were serial ports and parallel ports on PCs. Today, we have USB ports and LAN ports. Technicians talk about connecting customers to ports on access equipment, for example, equipment with banks of modems.

In the computer software business, a port can be thought of as a doorway into the software running on the machine, a passageway to a specific computer program running on the computer.

ports
What is a Port?

Why is this necessary? Since there can be many computer programs (a.k.a. applications, apps) running on the same computer at the same time, when trying to communicate to a particular program, we require a mechanism to identify it, a way of telling the host computer to which program to relay our communications.

For example, we all know that it's possible to have multiple applications using the Internet connection on a computer at the same time. Think of an Outlook email program and a Chrome browser program running at the same time on a PC connected to the Internet.

When data arrives at this computer, how does the computer know whether this data is for the email program or for the browser program? And how does it convey the data to the correct program?

The answer: every program is assigned a number called a port number. Your browser is assigned port 80, for example.

Here's how it works: the sending program creates a message and tags it with the port number identifying the program it wishes to communicate with on the destination computer. This is put in a packet that is tagged with the network address (IP address) of the destination host computer and transmitted. When the packet arrives at the destination computer identified by the IP address, this receiving computer looks at the destination port number and parks the message in a memory space associated with that port number. The program on the destination computer assigned that port number is constantly checking that memory space to see if there is anything new waiting for it.

The result is the ability for a computer program running on one computer to communicate with a specific computer program on another computer.

Visiting our warehouse service a couple of weeks ago, I was struck by the analogy possible between the idea of computer ports and a multi-tenant warehouse, so whipped out my phone and took a picture with the panoramic feature.

The warehouse is analogous to the host computer. It has a single street address. It handles goods for multiple users. Users have space allocated inside the warehouse. The warehouse has (on this side) six ports, also called loading docks. Each port has a number. A user can be assigned a port, either temporarily or permanently.

To communicate goods to that user, they're carried in a shipping container (IP packet) on a truck (Ethernet frame) over a road (LAN cable) to the warehouse at its street address (IP address). To get the contents of the shipping container delivered to the correct user, the truck is backed up to the appropriate loading dock (port) identified by its door number (port number) and the contents of the container are unloaded to the space behind that port.

In computer communications today, the port number is 16 bits long, and the source and destination port number are populated at the beginning of the transport layer header, Layer 4 of the OSI model. The world's most popular standard protocols for implementing the transport layer are the TCP (Transmission Control Protocol) and UDP (User Datagram Protocol).

Hence, one hears of "TCP ports" and "UDP ports", particularly when configuring rules for packet forwarding on a router or firewall. When one "blocks" a port, that means that communication to a particular computer program is denied. When one "opens" a port, communication to that computer program is being allowed.

Standard practice is to allow communications only to specifically-identified ports and deny all other communications.

The port number of the application and the IP address of the host computer concatenated together is called a socket in UNIX and IP and is called a transport service in the OSI model. The result is the ability to identify the specific source computer program on one computer and the specific desired destination computer program on a different computer.

Join thousands of satisfied customers including the FBI Training Academy, US Marine Corps Communications School, US Army, Navy, Air Force and Coast Guard, CISA, DISA, DoJ NSD, NSA and CIA, IRS, FAA, DND, CRA, CRTC, RCMP, banks, power companies, police forces, manufacturers, government, local and regional telcos, broadband carriers, individuals, telecom planners and administrators, finance, tax and accounting personnel and many more from hundreds of companies.

Benefit from decades of knowledge, insight and experience distilled into clear lessons designed for non‑engineers, logically organized to build one concept on another... in plain English. Teracom's GSA Contract supplying this training to the US government reflects approved quality and value that you can depend on.

we provide training to at&t             we provide training to verizon             we provide training to Bell Canada             microsoft             we provide training to intel             we provide training to cisco             GSA contract holder - pre-approved pricing and quality - supplier to the US Government             cox cable