IPs and Ports

IPv4 addresses are like house addresses. Imagine the address (12345 Wooden Bluff). Just like when you need to know where to find your friends house, computers also need someway to find each other over the web. IPv4 addresses consist of 4 parts called octets and are separated by periods.

To understand this picture we need to understand how to count in binary. Please refer to our tutorial on that topic located here. Each section of the address can hold a maximum value of 255. This allows for a total of 256 4 = 4,294,967,296 unique addresses.


Now that we can think of IP addresses to be just like home addresses lets take it a step further. You may often hear of people using the term "router." A router is nothing more than a gatekeeper, as in it is like your front door. You keep it locked and only allow people you want in or disallow the ones you want out. The router acts as the door to your house and also displays your unique IP address.

Now lets imagine we entered the house and on first inspection could see a bunch of rooms. Similarly devices inside the routers network each have their own "room" and only communicate through exiting the "door." Previously when I mentioned how many total unique addresses could exist in an IPv4 address you may have wondered "I thought more than 4 billion devices existed?" You would be right and to cut down on IPv4 addresses a few protocols were developed, most commonly NAT. NAT allows a network to use a single address on its router and have each device inside use an address available only within the network.


Finally we need to take a look at each individual device and how they operate using "ports." Imagine your room, full of cabinets and drawers. To access each compartment you need to open them directly. Ports within each device allow for the network to access different applications. You may have also heard of "firewalls." While there are no walls of fire in your computer these applications are essential for automating the protection of your device from devious people.