I don’t do networking every day, so sometimes I need to look up the very basics again. So this is for my future self.
IP ranges are often defined in CIDR notation.
E.g., using IPv4: 129.69.69.15/18
What does this mean? An IPv4 ip consist of 32 bits (binary digits :) ). By convention, we divide an IP address into four parts of eight bits, each, and convert each binary number to decimal.
1000 0001 0100 0101 0100 0101 0001 0010
|--------|---------|---------|---------|
129 . 69 . 69 . 15
Going back to our example of 129.69.69.15/18
, the decimal number after the slash defines the number of constant bits.
The other bits may vary.
How does this define an IP range? Well, in binary:
129 . 69 . 69 . 15
|--------|---------|---------|---------|
1000 0001 0100 0101 0100 0101 0001 0010
--- bits 1 to 18 --->|
So, the first eighteen bits are constant, all the following bits are allowed to vary. Thus, the IP range starts with:
1000 0001 0100 0101 0100 0000 0000 0000
--- bits 1 to 18 --->|
and ends with:
1000 0001 0100 0101 0111 1111 1111 1111
--- bits 1 to 18 --->|
which translates to 129.69.64.0
to 129.69.127.255
.
So, our initial example of 129.69.69.15/18
is rather dumb, because it just uses an ip that is somewhere in the middle of the range.
Using the first ip address of the range makes more sense: 129.69.64.0/18
.