# IPv4 Subnetting Notes

The other day someone asked me to explain subnetting. It had been a while so I dusted off my CCNA books and attempted to answer his questions. So I thought this would be an ideal time to jot down some notes for future reference.

This isnt a tutorial or guide but just some some notes on how to calulate the different subnetting values (subnet number, number of hosts etc etc).

• 128 – 256 = 128
• What is the highest number you can make by placing multiple 128`s into 0. None so this is 0.
• (0 + 128) – 1 = 127

How many subnets and hosts per subnet can you get from the network 172.30.0.0 255.255.255.240 ?

• 172.30 is a class B RFC 1918 address and has a /12 prefix. So 12 bits of this address we can do nothing with.
• The subnet mask is /28 so this mean we can break the address into the following :
• 28 bits – 12 bits  = 16 subnet bits
• 28 bits – 32 bits = 4 host bits
• This means that this subnet number will conisist of [12 network ID bits ] [16 subnet bits] [4 host bits]
• With the following power of 2`s in mind we can calculate the hosts and subnets :
65536 32768 16384 8192 4096 2048 1024 512 256 128 64 32 16 8 4 2 1
• Host bits = go along 4 and then an extra 1 (saves adding them up) then minus 2 due to the the broadcast and subnetnet zero bits. This gives us 14
• Subnet bits = go along 16 and then 1 extra gives us 65536 subnets.

Answer : 65536 subnets and 14 hosts per subnet.

Which subnet does host 172.24.102.208 255.255.255.224 belong to?

• 224 – 256 = 32
• Whats the highest number we can get by placing 32`s into 208 = 192

What valid host range is the IP address 192.168.126.95/26 a part of?

• 192 = 256 = 64
• Highest number that you can get from placing 64’s into 95 = 64.
• 64 = Subnet number
• 64 + 1 = First host
• (64 + 64) – 1 = Broadcast
• (64 + 64) – 2 = Last host

What valid host range is the IP address 172.16.93.193/20 a part of?

• 240 = 256 -16
• Highest number that you can get from placing 16’s into 93 = 80.
• 80 = Subnet number
• x.x.80.1 = First host
• x.x.80.1 (add 16 to 80 and minus 1), and place .254 into the last octect = Last Host