logo

Practical Computing Advice and Tutorials

Tue: 23 Jul 2019


Site Content

Programming
&
Development


Technical Knowhow


Command Line Interface


Security

IP Addresses

What is an IP Address?

The long explanation is very long and requires you to understand the relationship between the 12 digit (for IPv4) dotted-decimal-notation (D.D.N) numbers and the underlying 32-bits of binary code and how the IP Address of the devices is separated out from the IP Address of the network using a 'Network Mask'. I've seen some short explanations that simply lack enough detail to be of much use to the reader, as well as some very technical and comprehensive explanations that run into dozens of pages. Here, I'll attempt to find some middle ground. Also, this post is about IPv4, not IPv6.

In the same way as your home and the people living there can receive mail from anywhere in the world, so long as the sender knows the destination Postal Address, and you can send mail to anyone else in the world, so long as you know the destination Postal Address, an analogy can be made between that system and the IP Address system.

An IP Address has to be unique to both the network and machines that are connected to that network. But, in the same way as your given name is not going to be unique to you, so your machine IP Address is not going to be unique either: It will be 'unique' for the LAN to which it's connected, but not from a 'world wide' perspective, just as your given name will be (corner cases aside) unique to your household, but not to the world.

In my post about Home Router Configuration, I introduced the notion of the machines on your LAN sharing the one IP Address that your ISP assigned to you. Here, the analogy of that, is that the people living in your home share the same postal address and when something arrives, you know to whom that packet should be given, by the name on it. Your NAT Router does that same thing: When something arrives with the correct 'name' on it, it'll forward that to the machine with that 'name'; substitute 'name' for 'IP Address', and that's what your NAT Router is doing. Also, just as you will (likely) put any post that's not specific to someone at your address, in the bin, so does your NAT Router.

So, at a minimum, when you're connected to the Internet, you have two IP Addresses: an External, or 'public' Address (WAN), which has been assigned to you by your ISP, and may not be 'static', and an Internal, or 'privet' Address (LAN), which again, may not be 'static'. If these addresses change for any reason, the Routers will sort this out, so you don't have to concern yourself with it, but I'm generalising here, for the sake of brevity.


To simply connect two computers together requires nothing more than a couple of wires.







But, when you start to scale that up, it gets very messy, plus each computer would need as many network interface cards (NICs), as computers it needs to connect to.







We can make things less messy while, at the same time, requiring each computer to have just one NIC, by having a common connection point: a Switch.






But now that the computers are no longer connected to each other, but rather via a Switch, so how does the data get from one computer to the required destination computer? This is where the concept of Network Addressing comes in.

Now, any computer can send and receive data to/from any of the other computers. And, because we're using 32-bit numbers, we could have a little under 4.3 billion machines connected, starting at 0.0.0.0 and ending at 255.255.255.255. While it's possible, it's impractical to connect even a few hundred computers in this way, let alone a few thousand; millions would be out of the question.










To get around this, it would be better to have small groups of computers and then connect the groups together, like this.

Better, but far from perfect, as this would not scale very well. What if one of the groups wanted an additional machine or two? If we had 10,000 groups like this, each group would have to know what addresses each of the other groups was using, so it becomes a huge task just to keep tabs on that information.

The other issue is that because each Switch needs to keep a record of what is connected to each of its NICs, by sending and requesting update messages, the network traffic would very soon be so much that the network would simply fail. The solution is to create a new network for each group of machines.

Now, we have 36 machines, but we've only used 8 Public IP Addresses, as each of the groups can use the same Privet Address space. Privet IP Addresses are not routable across a Public network, so if a machine on one network needs to communicate with a machine on a different network, it simply sends the data to its Default Gateway (in your home, that's your NAT Router).

Let's assume that the computer at the top left, makes a request to contact the computer at the bottom right. It has the IP Address of the Network that it needs to connect to, either because of a technology like 'DNS' (Domain Name System), or the user simply typed the IP Address into an application. We'll also assume that the request was for a Web Page, so the request that's been sent is http://20.0.0.8:80 (IP Address 20.0.0.8, port 80).

The data packet will be bounced from Router to Router, each one swapping out the source IP Address for its own, getting the data one step closer, until at Network 20.0.0.8, that Router knows that a machine on one of its connected networks has a machine with an open Port 80, and the connection is made.

Although this is a very simplistic view, I hope that it serves to simply illustrate the concept, without clouding the issue with too much technical detail.