Subnetting
| Done |
|---|
CIDR (Classless Inter-Domain Routing)
IANA (Internet Addressing Numbers Authority) assigns ip address to companys according to their size
CIDR and FLSM (Fixed-Length Subnet Masks)
Introduced in 1993 by the IETF (Internet Engineering Task Force) in order to reduce the waste of ipv4 addresses.
How to calculate usable adresses?
š”
n is the number of host bits
Subnets from class C
| Mask | CIDR Notation | Host Bits | Usable Addresses |
|---|---|---|---|
| 255.255.255.128 | /25 | 7 | 126 |
| 255.255.255.192 | /26 | 6 | 62 |
| 255.255.255.224 | /27 | 5 | 30 |
| 255.255.255.240 | /28 | 4 | 14 |
| 255.255.255.248 | /29 | 3 | 6 |
| 255.255.255.252 | /30 | 2 | 2 |
| 255.255.255.254 | /31 | 1 | 0(2)* |
| 255.255.255.255 | /32 | 0 | 0(1)** |
š”
* If we disregard the reserved addresses we can say that we have 2 addresses, making it perfect for Point-to-Point connections.
š”
**Similarly as the /31 mask, we can think of the /32 as a single address, making it perfect for solutions targeting only one address. For example, a static route to a single pc (host).
How to calculate how many subnets are in a mask?
š”
y is the number of borrowed bits from the network portion
Subnets from class C
| CIDR Notation | N° subnets | N° Addresses |
|---|---|---|
| /25 | 2 | 126 |
| /26 | 4 | 62 |
| /27 | 8 | 30 |
| /28 | 16 | 14 |
| /29 | 32 | 6 |
| /30 | 64 | 2 |
| /31 | 128 | 0(2) |
| /32 | 256 | 0(1) |
How to know the network address of a subnet from an IP Address?
- Convert the number to binary
- 172.25.217.192
- X.X.11011001.1100000
- Separate the Borrowed Network Portion from Host Portion
- X.X.11011|001.11000000
- Turn the Host Portion to 0
- X.X.11011|000.00000000
- Convert from binary to decimal
- X.X.216.0
- Answer
- X.X.216.0/21
How to know the broadcast address of a subnet from an IP Address?
- Convert the number to binary
- 172.25.217.192
- X.X.11011001.1100000
- Separate the Borrowed Network Portion from Host Portion
- X.X.11011|001.11000000
- Turn the Host Portion to 1
- X.X.11011|111.11111111
- Convert from binary to decimal
- X.X.223.255
- Answer
- X.X.223.255/21
VLSM (Variable-Length Subnet Masks)
It is more efficient, since it allow different prefix-lengths
- Assign the first subnet to the largest one starting from the address space
- Address the second biggest subnet
- Repeat
