Ports (Wiki)

The content of the Security Analogies wiki is now available here, under the GNU Free Documentation License 1.2.

Thanks to Dbridger for the content of this page.


A computer can be thought of as an apartment building. Its IP address is its street address and port numbers are the apartment numbers. Some computers have domain names, such as www.securityanaolgies.com. Similarly, an apartment building may have a name like 'White Hat Apartments'. Looking up a domain name is like finding out that 'White Hat Apartments' (Domain Name) is located at 123 Oak Street (IP address).

Ports and Services

If you go to an apartment and knock on one of the apartment doors and someone answers, that's like a service listening on that port. If you speak the same language as the person who opened the door (i.e. are using the same Protocol), you can communicate with that service. If someone answers the door, the port is considered Open or Accepted. If you hear someone shout "Go away", the port is considered Closed or Denied. If no one answers, the port is considered Filtered, Dropped or Blocked. Some services, such as HTTP or FTP, always (for sake of argument) use the same port. This is like everyone knowing that Harry lives in apartment 80 and Fred lives in apartment 23. Some services don't always use the same port, this is like if you don't know what apartment they live in, you don't know how to connect with them. If you go to a number of doors and see if anyone answers, that is called port scanning.


A router sitting in front of the computer can be thought of as a door man. The door man can tell you you are not allowed to go to apartment 80 (this is port blocking or port filtering). The door man can tell you that the person in apartment 80 is now living in apartment 100 (this is called port forwarding).


Note: this analogy was found in WikiPedia under TCP and UDP Port and expanded upon.

WebSanity Top Secret