If you are new to computer networking the best way to understand IP addresses and ports is to use an analogy. Imagine Tom is staying in room 303 at a 3 story hotel in DC and Sue is staying in room 202 at a 3 story hotel in Boston.
When Sue wants to send a letter to Tom, what does she put on the envelope?
Also, when Sue wants to call Tom, she can call (202)555-1212 [IP address] ext. 303 [Port]
So, how does a Port work in the internet world?
- You have multiple programs that are running on your computer
- A port number is assigned to each program that uses the Internet on your computer
- There are 2 types of programs:
- Service-providing programs
- Service-requesting programs
- An example: When you type “HTTP” into your Internet Browser that program may use port 1025.
- Your computer also has an IP Address that looks like this: 192.168.1.10 that identifies your computer on the network (the IP address may also look like this: fd98:c3de:669c:b65c)
When the Internet Browser sends a message to the Web Server like this:
An Internet Protocol address (IP address) is a numerical label assigned to each device (e.g., computer, printer) participating in a computer network that uses the Internet for communication. An IP address serves two principal functions: host or network interface identification and location addressing.
A port (TCP/UDP) is an address associated with a particular process on a computer. Ports have a unique number in the header of a data packet that is used to map this data to that process. Port numbers are divided into three ranges: Well Known Ports, Registered Ports, and Dynamic/Private Ports. Default port values for commonly used services have values lower than 255 and Well Known Ports have numbers that range from 0 to 1023. Registered Ports range from 1024 to 49151 and Dynamic/Private Ports range from 49152 to 65535. An "open port" is a port number that is configured to accept packets while a "closed port" is one that is set to deny all packets with that port number.