Networking Basics for the Aspiring Hacker, Part One: IP Addresses
Recently, there have been some questions regarding networking popping up and we have decided to put together this series to try and cover this gap.
In this guide, we will cover the basics of IP addresses, both internal and external, and begin to have a a look at how this wonderful internet of ours works.
Okay, so let's break it down into something we all understand—the postal service. Every building's address is made up of 4 things—a state, a city, a building, and a street number—that when it's all put together identify one building. If you want to send me a package, you need to know all these things to ensure the package gets to me.
Let's convert this into computers. An IP address is broken down into 4 parts, called octets that are used to identify every point (think building) on the internet. To send a package (called packets on the internet) from my computer to your computer I need to know the 4 octets that make up your address, just like sending a package through the mail service.
E.g. If I send a packet from my address at 184.108.40.206 to you at 220.127.116.11, the internet will act as the mail service and use this address to know which building to send the packet to.
Many of you will now be wondering what's inside our buildings on the internet. So let's break it down into the postal service again.
Imagine at our address from before (18.104.22.168) is a large apartment building. Each floor has one large apartment that takes up the whole floor, and the postman doesn't know the numbers of each apartment. So, instead he gives all the mail for the building to a wee man called NAT who is sitting at the door to our building, who then makes sure they get to the right apartments.
So, in computer speak, each "building" is the router/modem that connects you into the internet, the little man at the door is a service called NAT (more on this in the next article), and each floor is a device using the internet inside your home.
To make sure each packet gets to the right device, NAT needs to know which floor is which. He does this by assigning them a special address known as an Internal IP address. These are only for use within the building NAT is in and are usually in the form of (192.168.1.**) where the stars are a number that is your floor (device).
E.g. When my packet for you gets through the internet (mail service) to your building's address 22.214.171.124, NAT picks it up and says, "Oh, look it's for Mr. 192.168.1.101, I'll run that to his floor now," and away he goes to floor number 101 inside your building and delivers this packet.
Right, onto our apartments.
So, each of our apartments is a whole floor. But there is a big hallway with many doors into our apartment and each of them has a number. Inside door number one could be our kitchen, door number two could be our living area, and so on.
In computers, our big hallway is what is called a loop-back adapter, and it is a way of us talking to ourselves, the doors are called ports, and inside each port is a service (more on these later on in the series, for now we just have to know they exist).
E.g. If I want to go to the kitchen from the living area, I go out door 2 (living area) into 127.0.0.1 and back into door 1 (kitchen).
Okay, so now we know we have an IP address for our router/modem (building) and we have a different one for your device (apartment). There is a wee man called NAT that takes everything for your router's IP address (buildings address) and delivers it to each devices IP address (floor number) inside the network. In our device is a loopback adapter (hallway) which lets us go out one port (door) and back in to another service (room).
I hope this has explained things in a way that is a little bit easier to understand, and has provided a mental visual guide for you to refer back to if you ever get confused.
Stay classy, Nullbyteians, and stay tuned for more in this series