I'm making a concerted effort to capture my notes on networking stuff I've built up over time. The overarching goal with this is to provide easily consumable chunks of information, that are loosely linked together.
With this piece, we aim to build a fairly strong notion of what an IP address is, how they're structured, and a brief treatment of some of the different kinds of IP addresses out there.
What's an IP address
An IP address is a name for every device on a network. IP addresses fundamentally enable us to connect with and communicate with a specific device or host on a network.
What does an IP address look like?
Whilst we can represent an IP address in a few ways, it depends on a few things - the version of the internet protocol(IP) a specific network is using is a major factor in this.
In the past, most networking setups centred around IPv4 (that is, version 4 of the internet protocol), and under IPv4, a common way of formatting IP addresses was called 'dotted quad notation'. That looks something like this:
a.b.c.d
In the example above, a/b/c/d are numbers between 0 and 255 (inclusive) - i.e there are 256 possible values. These are called 'octet' numbers1.
How does a machine or device acquire an IP address?
On the top level, an ISP dishes out IP addresses at the point that a device connects to the network.
Is the IP address of my device permanent?
It turns out IP addresses have a finite supply. That makes sense if you think about it (if the format is a.b.c.d there are going to be a limited number of combinations of this - we'll look at how many combinations in a moment).
You could imagine an ISP owning a block of IP addresses it can assign to devices that connect to it. A device connects to a network and it's given an IP address. When that device disconnects from the network, what should happen with this IP address?
We could turn this problem around a little; what's the use of an IP address? If we go back to our definition:
An IP address is a name for every device on a network
Once a device has disconnected from a network, it's no longer reachable on the network even if we had the address. At this point, the address is pretty meaningless - even if we try to communicate over it, nothing will respond. And as the other device has disconnected from the network entirely, it's likely not important any more to even have that machine be addressable.
One strategy that is used to better utilise the block of IP addresses is to reclaim that IP address for a different machine once the original device has disconnected. In this instance, the IP address is considered as dynamic ip address. With dynamic ip addresses, a single address may represent multiple machines over time. By re-assigning IP addresses, we can avoid running out of IP addresses.
It may be important for us to always know the address of a specific device or a set of devices. If we wanted to be very selective over which devices we connected to for security reasons, we might chose to block all IP addresses apart from a vetted list of addresses. This doesnt really work under dynamic ip addressing, but its possible to acquire static ip addresses which provide unchanging points of contact.
What's IPv6?
Another way of dealing with the finite supply of IPv4 addresses has been to change the format to increase the number of addresses. Generally these are formatted a little differently from IPv4 addresses:
xxxx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx
We move to 8 blocks of 16 bits, which means we can encode up to 2^128
addresses (16 x 8 = 128
), hence the '128 bit' monicker. Each octet in IPv4 is an 8 bit value, and we have 4 of them, so we can encode up to 2^32
addresses (8 * 4 = 32
). It's a difference of many magnitudes.
Calling It
At this point, you should be able to recognise IPv4 and IPv6 addresses. You'll have an understanding of why the IPv4 vs. IPv6 distinction is so important for IP addresses, and some sense of strategies that can and have been used to mitigate the limited pool of IPv4 addresses.
Truth be told, this is a surface level treatment of IP addresses - there's a fair bit more detail, but we'll deal with that in another post.
It may be you need more detail, or another way of phrasing the problem. I am fond of Cloudflare's explanation of what an IP address is if you need another perspective.
The name comes from the fact that log_2(256) = 8
, i.e 256 is actually 2^8
, which is where the notion of Octect comes from.
Updated the post on 2019/10/30 to better detail the dynamic ip section.
Fixed some things on 2020/04/28 that were oversimplifying too much and ending up kind of wrong.