Subnetting
Binary Chart
| 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
| 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 |
For example, the number 7, with only 4 bits, is equal to 0111.
Using the above binary chart, any number can be created with 8 bits from 0-255
IPv4 Binary
| 192 | 168 | 0 | 1 |
| 11000000 | 10101000 | 00000000 | 00000001 |
Hexadecimal Calculation
Hexadecimal uses 16 Digits
| Number | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
|---|---|---|---|---|---|---|---|---|---|---|
| Equals | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
| Letter | A | B | C | D | E | F |
|---|---|---|---|---|---|---|
| Equals | 10 | 11 | 12 | 13 | 14 | 15 |
In hex (base 16), place values are powers of 16.
| 163 | 162 | 161 | 160 |
| 4096 | 256 | 16 | 1 |
Example, convert 3BF2 to decimal
| Hexadecimal Number | 3 | B | F | 2 |
|---|---|---|---|---|
| Hex Digits | 3 | 11 | 15 | 2 |
| Place Value in Hex | 163 | 162 | 161 | 160 |
These values are assigned from chart above
Calculate
| 3 | 163 = 4096 | 3 x 4096 = 12288 | |
| B | 162 = 256 | 11 x 256 = 2816 | |
| F | 161 = 16 | 15 x 16 = 240 | |
| 2 | 160 = 1 | 2 x 1 = 2 |
12288 + 2816 + 240 + 2 = 15346
3BF2 = 15346
Example, 15346 back to hexadecimal
Key: multiples of 16
| Divide by 16 | Take solution and x by 16 | Subtract by initial decimal | Hex Digit | |
|---|---|---|---|---|
| 1 | 15346 / 16 = 959 r 2 | 16 x 959 = 15344 | 15346 – 15344 = 2 | 2 |
| 2 | 959 / 16 = 59 r 15 | 16 x 59 = 944 | 959 - 944 = 15 (15 = F) | F |
| 3 | 59 / 16 = 3 r 11 | 16 x 3 = 48 | 59 – 48 = 11 (11 = B) | B |
| 4 | Remainder 3 | -> | -> | 3 |
Take Hex Digit in reverse (2FB3 to 3BF2)
Solution: 3BF2
IP Address Classes
| Class A | First octet between 0-127 |
| Class B | First octet between 128-191 |
| Class C | First octet between 192-223 |
| Class D | First octet between 224-239 |
| Class E | First octet between 240-255 |
Calculating Subnet Mask
Subnet Mask for 10.200.20.0/27
Based off the CIDR for IPv4 Address. Move 27 bits from left to right.
| Details | 1st Octet | 2nd Octet | 3rd Octet | 4th Octet | Decimal |
|---|---|---|---|---|---|
| IPv4 | 0000 1010 | 1100 1000 | 0001 0100 | 000|0 0000 | 10.200.20.0/27 |
| Subnet Mask | 1111 1111 | 1111 1111 | 1111 1111 | 111|0 0000 | 255.255.255.224 |
| Bits | /8 | /16 | /24 | /32 |
Calculating Subnet ID
Subnet ID for 10.200.20.0/27
See /27, which translates to 11111111.11111111.11111111.11100000, in binary.
This equals 255.255.255.224, which is the subnet mask.
Take 256 – 224 = 32 (This means each subnet has 32 IPs)
256 is the total number of values on one octet (0-255, including the 0)
| Subnet | Range of Addresses | Broadcast |
|---|---|---|
| 10.200.20.0/27 | 10.200.20.0-10.200.20.31 | 10.200.20.31 |
| 10.200.20.32/27 | 10.200.20.32-10.200.20.63 | 10.200.20.63 |
| 10.200.20.64/27 | 10.200.20.64-10.200.20.95 | 10.200.20.95 |
The subnet ID is the first address in the range 10.200.20.0
Calculating Broadcast Address
Broadcast Address for 10.200.20.0/27
Set bits in the host part to 1, see IPv4 4th octet.
| Details | 1st Octet | 2nd Octet | 3rd Octet | 4th Octet | Decimal |
|---|---|---|---|---|---|
| IPv4 | 0000 1010 | 1100 1000 | 0001 0100 | 000|0 0000 | 10.200.20.0/27 |
| Subnet Mask | 1111 1111 | 1111 1111 | 1111 1111 | 111|0 0000 | 255.255.255.224 |
| Bits | /8 | /16 | /24 | /32 |
| 4th Octet | |
| → | 000|0 0000 |
| Flip host bits → | 000|1 1111 |
| = 31 | |
Broadcast Address is 10.200.20.31
Found by taking the first 3 octets (10.200.20.XXX) and then turning the red 0s on, in the fourth octet, making 000|1 1111, which is 31.
Homework
| Binary Address | Dotted Decimal |
|---|---|
| 01101000 11110001 00001101 10110110 | |
| 10100000 11111111 11111110 01011000 | |
| 01111001 00110011 10000001 11100000 | |
| 11110000 11111110 10110001 00110001 | |
| 10101010 00011100 10100110 11100011 |
| Dotted Decimal | Binary Address |
|---|---|
| 188.26.221.100 | |
| 88.91.200.84 | |
| 150.15.60.20 | |
| 222.161.25.10 | |
| 220.10.5.18 |
| Hexadecimal Number | Decimal Equivalent |
|---|---|
| 3BF2 | |
| 468A | |
| C40E | |
| 1D16 | |
| 2EE2 |
| Decimal | Hexadecimal Equivalent |
|---|---|
| 586 | |
| 5289 | |
| 25840 | |
| 252 | |
| 14732 |
| IP Address | Subnet Mask | Class | # of bits taken for subnet | Network ID | Subnet ID |
|---|---|---|---|---|---|
| 188.26.221.100 | 255.255.255.240 | B | 12 | 188.26.0.0 | 188.26.221.96 |
| 128.125.132.191 | 255.255.255.128 | ||||
| 83.93.100.48 | 255.255.0.0 | ||||
| 204.158.32.45 | 255.255.255.248 | ||||
| 132.158.70.30 | 255.255.224.0 | ||||
| 158.157.68.25 | 255.255.252.0 |
IP Address 188.26.221.100 Subnet Mask 255.255.255.240
IP Address 188.26.221.100 Subnet Mask 255.255.255.240, as every bit in the first 3 octets for the subnet mask is turned on, the first 3 octets remain the same for subnet ID (188.26.221.???). Now the focus is solving the 4th octet.
| IP 4th Octet: 100 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 |
| Subnet Mask 4th Octet: 240 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 |
| 4th Octet Subnet ID: 96 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 |
The AND method is taking the last octet in the subnet mask, that's not 255, and the same octet in the IP address. Convert those octets to binary and any bits that are 1 AND 1 keep them for the subnet ID.
| Network ID | Subnet Requests | Class | Subnet Mask | Bits Taken | Second Subnet ID | Next to last Subnet ID |
|---|---|---|---|---|---|---|
| 172.15.0.0 | 50 | B | 255.255.252.0/22 | 6 | 172.15.4.0 | 172.15.248.0 |
| 16.0.0.0 | 500 | |||||
| 121.0.0.0 | 1000 | |||||
| 157.158.0.0 | 20 | |||||
| 215.100.10.0 | 16 |
Network ID 172.15.0.0 Subnet Requests 50
| Subnet ID | Subnet Mask | Class | First IP Address | Last IP Address | Broadcast Address |
|---|---|---|---|---|---|
| 40.50.240.0 | /20 | A | 40.50.240.1 | 40.50.255.254 | 40.50.255.255 |
| 143.30.64.0 | /18 | ||||
| 220.200.50.96 | /28 | ||||
| 210.120.50.160 | /27 | ||||
| 129.100.128.0 | /20 |
Subnet ID 40.50.240.0 Subnet Mask /20
| Subnet ID | 40 | 50 | 240 | 0 |
| Subnet Mask | 255 | 255 | 240 | 0 |
| Broadcast | 40 | 50 | 255 | 255 |