← Home

Subnetting

Binary Chart

11111111
1286432168421
2726252423222120

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

19216801
11000000101010000000000000000001

Hexadecimal Calculation

Hexadecimal uses 16 Digits

Number0123456789
Equals0123456789
LetterABCDEF
Equals101112131415

In hex (base 16), place values are powers of 16.

163162161160
4096256161

Example, convert 3BF2 to decimal

Hexadecimal Number3BF2
Hex Digits311152
Place Value in Hex163162161160

These values are assigned from chart above


Calculate

3163 = 40963 x 4096 = 12288
B162 = 25611 x 256 = 2816
F161 = 1615 x 16 = 240
2160 = 12 x 1 = 2

12288 + 2816 + 240 + 2 = 15346

3BF2 = 15346

Example, 15346 back to hexadecimal

Key: multiples of 16

Divide by 16Take solution
and x by 16
Subtract by initial
decimal
Hex
Digit
115346 / 16 = 959 r 216 x 959 = 1534415346 – 15344 = 22
2959 / 16 = 59 r 1516 x 59 = 944959 - 944 = 15 (15 = F)F
359 / 16 = 3 r 1116 x 3 = 4859 – 48 = 11 (11 = B)B
4Remainder 3->->3

Take Hex Digit in reverse (2FB3 to 3BF2)

Solution: 3BF2

IP Address Classes

Class AFirst octet between 0-127
Class BFirst octet between 128-191
Class CFirst octet between 192-223
Class DFirst octet between 224-239
Class EFirst 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.


Details1st Octet2nd Octet3rd Octet4th OctetDecimal
IPv40000 10101100 10000001 0100000|0 000010.200.20.0/27
Subnet Mask1111 11111111 11111111 1111111|0 0000255.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)

SubnetRange of AddressesBroadcast
10.200.20.0/2710.200.20.0-10.200.20.3110.200.20.31
10.200.20.32/2710.200.20.32-10.200.20.6310.200.20.63
10.200.20.64/2710.200.20.64-10.200.20.9510.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.

Details1st Octet2nd Octet3rd Octet4th OctetDecimal
IPv40000 10101100 10000001 0100000|0 000010.200.20.0/27
Subnet Mask1111 11111111 11111111 1111111|0 0000255.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 AddressDotted Decimal
01101000 11110001 00001101 10110110
10100000 11111111 11111110 01011000
01111001 00110011 10000001 11100000
11110000 11111110 10110001 00110001
10101010 00011100 10100110 11100011
Dotted DecimalBinary Address
188.26.221.100
88.91.200.84
150.15.60.20
222.161.25.10
220.10.5.18

Hexadecimal NumberDecimal Equivalent
3BF2
468A
C40E
1D16
2EE2
DecimalHexadecimal Equivalent
586
5289
25840
252
14732

IP AddressSubnet MaskClass# of bits taken
for subnet
Network IDSubnet ID
188.26.221.100255.255.255.240B12188.26.0.0188.26.221.96
128.125.132.191255.255.255.128
83.93.100.48255.255.0.0
204.158.32.45255.255.255.248
132.158.70.30255.255.224.0
158.157.68.25255.255.252.0

IP Address 188.26.221.100 Subnet Mask 255.255.255.240

  1. 188.26.221.100 is class B
  2. Bits taken for subnetting is taking the CIDR of the current subnet mask and subtracting the default subnet mask for class B (/28 - /16), which is 12
  3. The network ID for 188.26.221.100, being class B, is 188.26.0.0
  4. Subnet ID can be found with AND method

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 01100100
Subnet Mask 4th Octet: 240 11110000
4th Octet Subnet ID: 96 01100000

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 IDSubnet
Requests
ClassSubnet MaskBits
Taken
Second Subnet
ID
Next to last Subnet
ID
172.15.0.050B255.255.252.0/226172.15.4.0172.15.248.0
16.0.0.0500
121.0.0.01000
157.158.0.020
215.100.10.016

Network ID 172.15.0.0 Subnet Requests 50

  1. 172.x.x.x = Class B Default Subnet Mask = 255.255.0.0 /16
  2. Bits taken for subnetting (subnet requests 50) 25 = 32 (not enough) 26 = 64 (Good)
    26 Borrow these 6 bits and add to default subnet (/16 + 6 bits = /22)
  3. Subnet mask is 255.255.252.0/22 (found by taking the default subnet mask and adding bits taken.

  1. Second subnet ID is found by taking the 3rd octet of the subnet mask (252) and subtracting from block size (256). 256 – 252 = 4. This means that subnets will start every 4 from that octet. 172.15.0.0, 172.15.4.0, 172.15.8.0, ... concluding that the second subnet ID is 172.15.4.0.
  2. Next to last is calculated by running up the 3rd octet by 4 to the end and then subtracting 4. So, 172.15.252.0 (252-4) 172.15.248.0

Subnet IDSubnet MaskClassFirst IP AddressLast IP AddressBroadcast Address
40.50.240.0/20A40.50.240.140.50.255.25440.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

  1. 40.50.240.0 is class A (1-126)
  2. /20 = 255.255.240.0
    256 – 240 = 16 This means each subnet jumps by 16 in the 3rd octet.
  3. 1st IP address is the subnet ID + 1, 40.50.240.1
  4. Broadcast is the top of the range for /20.
Subnet ID40502400
Subnet Mask2552552400
Broadcast4050255255
  1. Last usable IP address is the broadcast address minus 1 (40.50.255.254)