Finish the thoughts on CIDR
This commit is contained in:
parent
c1079fc314
commit
f2f5618f85
1 changed files with 14 additions and 5 deletions
|
@ -19,10 +19,11 @@ form, you get `00001010.00101010.00000111.00010011`. This is referred to as a
|
|||
bit string, which you'll notice contains exactly `32` bits as expected. Since
|
||||
an octet will always be `8` bits, the dot separators aren't needed in a bit
|
||||
string. This means that the bit string should really be written as
|
||||
`00001010001010100000011100010011`. This bit string is also known as a `32`-bit
|
||||
integer. In other words, it is a whole number that takes up exactly `32` bits of
|
||||
memory. This number can also be written in decimal form as `170526483`. We now
|
||||
have 3 ways to describe the same IP address:
|
||||
`00001010001010100000011100010011`. These bit strings can also be referred to as
|
||||
a `32`-bit integer. In other words, they are a whole number that takes up
|
||||
exactly `32` bits of memory. The example bit string number in this case could be
|
||||
written in decimal form as `170526483`. We now have 3 ways to describe the same
|
||||
IP address:
|
||||
|
||||
- `10.42.7.19`
|
||||
- `00001010001010100000011100010011`
|
||||
|
@ -39,4 +40,12 @@ known as a subnet mask.
|
|||
A subnet mask is a 32-bit string, similar to an IPv4 address, with the added
|
||||
constraint that it must be an initial series of `1` bits immediately followed by
|
||||
a series of `0` bits. This means that as soon as the first `0` bit appears, all
|
||||
remaining bits must be `0`.
|
||||
remaining bits must be `0`. The following bit string is a valid subnet mask:
|
||||
`11111111111111111111111100000000`. If you split up the 32 bits into 4 groups of
|
||||
octets, and convert those groups to decimal form, you get `255`, `255`, `255`,
|
||||
and `0`. We would write this as `255.255.255.0`. Another way of writing a subnet
|
||||
mask is CIDR notation, which is of the form `/N`, where `N` represents the
|
||||
number of `1` bits at the beginning of the mask. This means that writing
|
||||
`10.42.7.19/24` indicates you have the IP address `10.42.7.19` with the subnet
|
||||
mask of `11111111111111111111111100000000` (or `255.255.255.0`). You'll notice
|
||||
the mask has 24 `1` bits, the value of `N`.
|
||||
|
|
Loading…
Add table
Reference in a new issue