The IP Address Mess
Let’s talk about the network IP address and their translation, how it works and why we need them. But first let’s hear a bit of backstory; where do these little baby IP addresses come from anyways? Back in the late 70’s a couple of clever researchers were thinking about how long IPv4 addresses should be.
You have to consider that in every data packet we have to encode the sender IP and the receiver IP. If we only reserved a few bits to encode an IP address we can keep packet sizes small, however we will also have few IP addresses to send out to people.
If on the other hand, we choose to have lots of bits to encode an IPAddress we’ll have lots of IPv4 addresses to hand out, but we’ll also have huge packets which increases the communication overhead.
So as you can see, there’s a bit of a trade-off going on here. You can either have small packets, or lots of IP addresses.
They ended up deciding that they’d go with 32 bits for an IP address. That left them with roughly 4.2 billion ip addresses.
You have to consider that back then, the Internet, which wasn’t even called the internet back then, was just a toy for academics. It was definitely not meant for regular people like you and me. And that’s what’s known today as IP version 4.
Now hang on a second; Let’s do a bit of math here. We have 4.2 billion IPv4 addresses to hand out, but we also have seven billion people living on this planet as of 2012; and also consider that each of those seven billion people may want to use multiple devices to access the Internet.
So yeah we have a bit of a problem on our hands. What are we going to do about this now, because clearly having only four point two billion machines on the Internet is not going to be an option.
We have to figure something out; and there is a fix, but it’s as you’ll see a bit of a workaround. Let’s keep it at that.
There is in fact a way that we can keep using IP version 4, and get more machines onto the Internet.
Here’s a typical home network setup; This is John’s laptop, this is Jane’s laptop, and this is Jane’s smartphone.
They’re all connected to the home router. That home router in its turn, is connected to the Internet.
Now when you register with your ISP you get to use an IP address that is accessible throughout the internet; and that’s assigned to your home router. So in this case we have 220.127.116.11 assigned to the home router.
This is a public IPAddress that theoretically, anyone on the internet can send packets to. Our laptops and smartphones also get their own IP address, but instead of getting one of those 4.2 billion public IPv4 addresses, they get a private IP address.
That private IP address is assigned to them by the home router, and is not accessible from the Internet.
Now if these IP addresses look familiar to you, that’s probably because they are. This is one of two ranges that are reserved for private networks.
All addresses starting with 192.168 are reserved for private networks, as well as all addresses that start with the number 10. You can use these IP addresses without having to worry that some random web server already uses that IP address. They can because it’s specifically reserved for private networks.
Now let’s consider the connection from Jane’s laptop for a second. Jane’s laptop has an IP address of 192.168.1.3
Here’s an example scenario where Jane’s laptop wants to know what the current weather is in Texas, and to get this information, it will try to contact the server at 18.104.22.168, to get that information.
To reach this web server Jane’s laptop will have to go through the home router, through the internet, and finally then arrive at the web server.
First Jane’s laptop has to send out a pack requesting the information. It says what’s the current temperature in San Antonio Texas.
It’s from her router, and is not accessible from the Internet.
Now the message here isn’t really important. The web server should know what to do with that, and we won’t get into that right now.
But what you should know is that there is a source IP address here with the source port, and a destination IP address with a destination port. In this case it’s port 80 which is frequently used for HTTP traffic.
Now let’s send this package on its way shall we?
When it arrives at the web server, the web server will process the incoming requests, and try to formulate a reply. The reply packet will be addressed to the sender, but in this case, because it was sent from 192.168.1.3, it will not be reachable because it’s a private IPAddress.
So what do we do now? Let’s rewind that tape for just a second.
Jane’s laptop sends out a packet requesting the current temperature in San Antonio Texas. It gets sent along to the home router, but instead of sending it right over the Internet, the home router does something that’s a little bit sneaky.
When that packet re-emerges you’ll notice that the source IPv4 address has been changed. This is not the only thing that the home router does.
In addition, it also creates an entry in the NAT forwarding table. Now we’ll talk about NAT forwarding table again in just a second, but for now, all you have to remember is that this thing allows us to know which packets are to be sent to Jane’s laptop when they come in, and which packets are to be sent to that smartphone, or Jane’s laptop.
Moving right along, the packet travels over the Internet and arrives at the web server. The web server will now create a reply packet, and will notice that the destination IP address is no longer private. No. Instead it’s sent to the public ip address of our home router, on that specific port.
Now that our home router has received the response, it’s time for another tiny lie. It creates a packet that looks as if it was addressed from the web server directly to Jane’s laptop, which is not what happened.
But that’s all Jane’s laptop needs to know, because it doesn’t care about how it got there, it just wants to get the packet and get this over with. But how does it know where to send that packet it just received?
NAT, What Now?
The answer is in the NAT forwarding table. We just received that packet on port 24604, and that means, if we look in our NAT forwarding table, that we have to change the IP address on the private site, to 192.168.1.3 on that specific port over there in the forwarding table.
Jane’s laptop receives the packet, and the rest is history. Jane’s laptop doesn’t have to care about any of that NAT stuff. The home router completely handles it for Jane’s laptop, and it is completely transparent.
So Jane’s laptop doesn’t have to worry about public and private IP addresses. No, this is something the router fixes and Jane’s laptop doesn’t have to worry about it.
Of course, ideally, every computer would have its own public IPAddress, which is why we’re slowly moving over to IP version 6.
Remember how IP version 4 had 4.2 billion IP addresses at its disposal? Well IP version 6 has a “lot” more, and I do mean a lot. Seriously, try noting 34, then followed by 37 zeros, and that’s how much ipv6 addresses we have approximately.
That is a LOT.
If we can give every computer its own public IP address, we won’t be needing network address translation anymore. This means that routers can once again focus on their core business, which is routing packets, not doing awkward switcheroo tricks.
Now I can hear you saying; “This is nice and all, but why haven’t we switched yet? This IP version 4 thing is a mess. We only have 4.2 billion IP addresses, and that is…
clumsy as hell.”
Well it’s not that simple. We have a lot of Internet infrastructure, that was built up over the years, and they all work with IP version 4.
So we have laptops, desktops, home routers, but also stuff on the ISP side and web servers, and they all work with IP version 4. All these devices need to have hardware and software that supports IP version 6 before we can entirely switch over and that is a huge task.
Just to give you an idea; the IP version 6 standard was finalized in December of 1998, and yet here we are, 14 years later, and we’re still running on IP version 4.
You can see how the IPv4 addresses issue is one hell of a task.
Anyone Here Understand What An IP Address Is?
What is an IP address ? IPAddresses represent where you live on the Internet and are needed to send messages to computers outside of your network.
Imagine when you send a letter to your great aunt Mu, you put her address on the front of the envelope and the return address on the back. You send the message and…
Expect To Get A Reply:
This is what is going on with your computer right now as you’re reading this, except the destination address of the thousands of messages you’re sending every minute is some domain server, and the return or source address is…
The Computer In Front Of You.
Just like with house addresses you won’t find two computers connected to the internet with the same address. Somewhat differently though, computers don’t use geographical addresses but rather use a string of numbers called an IP address.
These IP locations are how the device is involved in passing the message, know who is sending what to whom. Not including a source IP when sending a message over the Internet would be like sending a letter with no return address to a complete stranger, who has to deal with billions of letters every minute and expect to get a reply.
Yeah good luck with that.
So quick recap; IP lookups are unique series of numbers which identify computers on the Internet.
- Want to watch YouTube? You need an ip address.
- Want to send an email? You need an IPAddress.
- Want to browse gifs of adorable cats? You need an IPv4 address.
If you look at an IP address in a bit more detail you’ll notice that it’s basically four numbers separated by dots.
Using dot or point between the numbers doesn’t really matter it’s just personal preference as mentioned in a previous tutorial, sending information across the network will eventually lead to ones and zeros being transmitted in the form of electrical signals.
An IP address has 32 of these ones and zeros.
With a little bit of arithmetic we can work out that there are four billion two hundred and ninety four million nine hundred and sixty seven thousand two hundred and ninety-six addresses available for use on the internet.
Wait hang on, there are seven billion people in the world, about three billion of whom are connected to the Internet.
Some of these people will have multiple internet connected devices, the number of which is going up literally every second.
Why yes, we most certainly are.
The super amazing techy people realized this problem back in the late 1990s and hence came up with the system to slow down the rate at which IP adresses were being used up.
That is called NAT.
Imagine that a postman standing at your front door, looking towards your house, is like looking at the devices on your home network.
And looking out towards the road is like looking out towards the Internet.
The postman takes three letters: one from Alex watching YouTube; one from David sending an email; and one from Jane watching…
The postman sends off these letters, and any replies get given to him. He then comes back to the house with the replies and gives them to Alex, David, and Jane respectively.
Same idea with NAT. It takes multiple addresses from inside your network, and presents a single IPAddress pointing out towards the Internet, thus reducing the number of IP addresses used.
This is why, if you take a look at your network settings at your house, and then ask a friend to do the same at theirs, it’s likely you’ll have
Incredibly similar Id adresses:
NAT is working in the background. And so this is you, this is your computer, and this is you finishing learning about what is an IP address._sstnq