Autosave: 2024-09-01 14:00:03

This commit is contained in:
thomasabishop 2024-09-01 14:00:03 +01:00
parent 1540869d30
commit 722892566b
3 changed files with 57 additions and 6 deletions

Binary file not shown.

View file

@ -43,6 +43,11 @@ align with the octet boundary. For instance, the prefix could be 25 bits in
length, rather than 24. In this case it would "steal" one bit from the host
section making it 23 bits in length.)
Any changes to the length of the network prefix change the number of hosts
available on the subnet. If the network prefix is longer, the number of unique
hosts is reduced. If the network prefix is shorted, the number of unique hosts
is increased.
## Identifying the network and host groupings
Given that the network prefix and host identifier do not always stick to set
@ -76,7 +81,8 @@ can be represented with a single 8-bit number and 0 is the smallest):
In the binary form, the 1 values represent the bits which designate the network
address and the 0 values represent the bits that designate the host.
In the example above this corresonds to the idealised 32-bit/8-bit ratio.
In the example above this corresponds to the idealised 32-bit:8-bit ratio of
CIDR /24.
There is a clever consequence of the subnet mask: if you apply a bitwise AND
operator against the IP address and mask (both in their binary form) you can
@ -85,7 +91,7 @@ determine whether two addresses are on the same network.
To compare the IP address 192.168.1.23 against 192.168.1.100 to demonstrate:
```
192.168.1.23;
192.168.1.23:
IP: 11000000.10101000.00000001.00010111
Mask: 11111111.11111111.11111111.00000000
Result: 11000000.10101000.00000001.00000000
@ -101,6 +107,50 @@ After applying the bitwise AND logic we see that the result is identical for
both IPs indicating they are on the same network (share the same network
prefix), whilst the host value is "masked".
// Example of not matching
Here is a scenario where the subnet mask indicates that two IPs are not on the
shared network:
// Are there masks other than 255.255.255.0?
```
192.168.1.23:
IP: 11000000.10101000.00000001.00010111
Mask: 11111111.11111111.11111111.00000000
Result: 11000000.10101000.00000001.00000000
___________________________________
192.168.2.1
IP: 11000000.10101000.00000010.00000001
Mask: 11111111.11111111.11111111.00000000
Result: 11000000.10101000.00000010.00000000
```
255.255.255.0 is not the only possible subnet mask. There are masks
corresponding to ratios other than CIDR /24. For example:
- 255.0.0.0 (/8)
- 255.255.0.0 (/8)
- 255.255.255.192 (/26)
- 255.255.255.240 (/28)
As noted previously, the different ratios will obviously affect the number of
unique hosts available on the subnet.
## Determining the range of hosts: practical example
Let's say we have the following IP address expressed in CIDR: 192.168.0.133/27.
In binary this would be:
```
110000000.10101000.00000000.100--00101
```
The `--` indicates the demarcation point between the network prefix and the bits
designated for the host. 32 - 27 leaves us 5 bits for our range of hosts. This
gives us 2^5 = 32 unique host values.
In fact it will actually be 30 values since the first value (`00000`) will be
used to identify the network itself and the last value (`11111`) will be the
broadcast address - the address used when a message needs to be sent to all
hosts on the network.
An actual host address in this range is included in the example: `00101`.

View file

@ -18,7 +18,8 @@ interfacing with the other.
The Internet Layer utilises the **Internet Protocol** to determine how devices
will be publicly identified to devices on other networks and how different
devices on the same local network will be distinguished from outside of this
network. This is achieved through Internet Protocol (IP) addresses.
network. This is achieved through
[Internet Protocol (IP) addresses](./IP_addresses.md).
## Packets
@ -34,4 +35,4 @@ data between sent between hosts. The header contains a source IP address and a
destination IP address and also specifies which version of the Internet Protocol
is being used.
// Separate entry on anatomy of IP address
// Need to find out more about packets work.