Subnetting

Efficiency
Examples
Configurator

Subnet Examples

Example 1: Class C with 28 subnets
Example 2: Class A with 2000 subnets
Example 3: CIDR (14 bits) with 2000 subnets
Exercises

TopExample 1: Class C, 28 subnets

Given
  • Class C addresses 235.114.18.0 (in CIDR-speak, 235.114.18/24)
  • 28 subnets are required
Calculate subnet mask
  • How many bits are required to create 28 subnets?
  • The number of subnets available is 2n - 2, where n is the number of 'borrowed' bits. The 2 subtracted is to allow for the network address (which cannot be a subnet) and the network broadcast (which cannot be a subnet). For more information see Subnetting Efficiency
  • 24 - 2 = 14. Not enough.
  • 25 - 2 = 30. Bingo!
  • The first 24 bits are assigned, the next 5 are subnetwork addresses. Any differences in these first 29 bits means the addresses are on different networks (and must be routed by the router).
  • The subnet mask is 29 1's followed by 3 0's:
    11111111 . 11111111 . 11111111 . 11111000
    Subnet mask is 255.255.255.248
  • The number of host addresses available on each subnet is 2m - 3, where m is the number of host bits (n + m + assigned bits = 32). The 3 subtracted is to allow for the network address (which cannot be a host), the broadcast (which cannot be a host) and the gateway (which cannot be a host). For more information see Subnetting Efficiency
    23 - 3 = 5
Calculate the settings for a router port on subnet 1
  • First usable 5-bit subnet is 00001.
  • The subnet 1 address is
    235.114.18. [ 0 0 0 0 1 ] { 0 0 0 }
  • Router port (gateway) will be the first usable address on subnet 1:
    235.114.18. [ 0 0 0 0 1 ] { 0 0 1 }
    Router port address is 235.114.18.9
Calculate the settings of a host on subnet 10
  • Tenth usable 5-bit subnet is 01010.
  • The subnet 10 address is
    235.114.18. [ 0 1 0 1 0 ] { 0 0 0 }
  • Gateway will be the first usable address on subnet 10:
    235.114.18. [ 0 1 0 1 0 ] { 0 0 1 }
    Gateway address is 235.114.18.81
  • Subnet mask is 255.255.255.248 (from above)
  • Host addresses start from the second usable address (the first is the router)
    235.114.18. [ 0 1 0 1 0 ] { 0 1 0 }
    First host's address is 235.114.18.82
  • Host addresses end at the last usable address (all 1's in the host field is broadcast)
    235.114.18. [ 0 1 0 1 0 ] { 1 1 0 }
    Last host's address is 235.114.18.86
  • This confirms that five hosts are permitted on each subnet (see above) with addresses:
    235.114.18.82
    235.114.18.83
    235.114.18.84
    235.114.18.85
    235.114.18.86

TopExample 2: Class A, 2000 subnets

Given
  • Class A addresses 39.0.0.0 (in CIDR-speak, 39/8)
  • 2000 subnets are required
Calculate subnet mask
  • How many bits are required to create 2000 subnets?
  • The number of subnets available is 2n - 2, where n is the number of 'borrowed' bits. The 2 subtracted is to allow for the network address (which cannot be a subnet) and the network broadcast (which cannot be a subnet). For more information see Subnetting Efficiency
  • 210 - 2 = 1022. Not enough.
  • 211 - 2 = 2046. Bingo!
  • The first 8 bits are assigned, the next 11 are subnetwork addresses. Any differences in these first 19 bits means the addresses are on different networks (and must be routed by the router).
  • The subnet mask is 19 1's followed by 13 0's:
    11111111 . 11111111 . 11100000 . 00000000
    Subnet mask is 255.255.224.0
  • The number of host addresses available on each subnet is 2m - 3, where m is the number of host bits (n + m + assigned bits = 32). The 3 subtracted is to allow for the network address (which cannot be a host), the broadcast (which cannot be a host) and the gateway (which cannot be a host). For more information see Subnetting Efficiency
    213 - 3 = 8189
Calculate the settings for a router port on subnet 1
  • First usable 11-bit subnet is 00000000 001.
  • The subnet 1 address is
    39. [ 0 0 0 0 0 0 0 0  .  0 0 1 ] { 0 0 0 0 0  .  0 0 0 0 0 0 0 0 }
  • Router port (gateway) will be the first usable address on subnet 1:
    39. [ 0 0 0 0 0 0 0 0  .  0 0 1 ] { 0 0 0 0 0  .  0 0 0 0 0 0 0 1 }
    Router port address is 39.0.32.1
Calculate the settings of a host on subnet 1653
  • 1653rd usable 11-bit subnet is 11001110 101.
  • The subnet 1653 address is
    39. [ 1 1 0 0 1 1 1 0  .  1 0 1 ] { 0 0 0 0 0  .  0 0 0 0 0 0 0 0 }
  • Gateway will be the first usable address on subnet 1653:
    39. [ 1 1 0 0 1 1 1 0  .  1 0 1 ] { 0 0 0 0 0  .  0 0 0 0 0 0 0 1 }
    Gateway address is 39.206.160.1
  • Subnet mask is 255.255.224.0 (from above)
  • Host addresses start from the second usable address (the first is the router)
    39. [ 1 1 0 0 1 1 1 0  .  1 0 1 ] { 0 0 0 0 0  .  0 0 0 0 0 0 1 0 }
    First host's address is 39.206.160.2
  • Host addresses end at the last usable address (all 1's in the host field is broadcast)
    39. [ 1 1 0 0 1 1 1 0  .  1 0 1 ] { 1 1 1 1 1  .  1 1 1 1 1 1 1 0 }
    Last host's address is 39.206.191.254

TopExample 3: 14 assigned bits, 2000 subnets

Given
  • CIDR addresses 144.172/14
  • 2000 subnets are required
Calculate subnet mask
  • How many bits are required to create 2000 subnets?
  • The number of subnets available is 2n - 2, where n is the number of 'borrowed' bits. The 2 subtracted is to allow for the network address (which cannot be a subnet) and the network broadcast (which cannot be a subnet). For more information see Subnetting Efficiency
  • 210 - 2 = 1022. Not enough.
  • 211 - 2 = 2046. Bingo!
  • The first 14 bits are assigned, the next 11 are subnetwork addresses. Any differences in these first 25 bits means the addresses are on different networks (and must be routed by the router).
  • The subnet mask is 25 1's followed by 7 0's:
    11111111 . 11111111 . 11111111 . 10000000
    Subnet mask is 255.255.255.128
  • The number of host addresses available on each subnet is 2m - 3, where m is the number of host bits (n + m + assigned bits = 32). The 3 subtracted is to allow for the network address (which cannot be a host), the broadcast (which cannot be a host) and the gateway (which cannot be a host). For more information see Subnetting Efficiency
    27 - 3 = 125
Calculate the settings for a router port on subnet 1
  • First usable 11-bit subnet is 00 00000000 1.
  • The subnet 1 address is
    144. 1 0 1 0 1 1 [ 0 0  .  0 0 0 0 0 0 0 0  .  1 ] { 0 0 0 0 0 0 0 }
  • Router port (gateway) will be the first usable address on subnet 1:
    144. 1 0 1 0 1 1 [ 0 0  .  0 0 0 0 0 0 0 0  .  1 ] { 0 0 0 0 0 0 1 }
    Router port address is 144.172.32.129
Calculate the settings of a host on subnet 1653
  • 1653rd usable 11-bit subnet is 11 00111010 1.
  • The subnet 1653 address is
    144. 1 0 1 0 1 1 [ 1 1  .  0 0 1 1 1 0 1 0  .  1 ] { 0 0 0 0 0 0 0 }
  • Gateway will be the first usable address on subnet 1653:
    144. 1 0 1 0 1 1 [ 1 1  .  0 0 1 1 1 0 1 0  .  1 ] { 0 0 0 0 0 0 1 }
    Gateway address is 144.175.58.129
  • Subnet mask is 255.255.255.128 (from above)
  • Host addresses start from the second usable address (the first is the router)
    144. 1 0 1 0 1 1 [ 1 1  .  0 0 1 1 1 0 1 0  .  1 ] { 0 0 0 0 0 1 0 }
    First host's address is 144.175.58.130
  • Host addresses end at the last usable address (all 1's in the host field is broadcast)
    144. 1 0 1 0 1 1 [ 1 1  .  0 0 1 1 1 0 1 0  .  1 ] { 1 1 1 1 1 1 0 }
    Last host's address is 144.175.58.254

TopExercises

  1. Given the Class B address 119.48.0.0 and a need for 500 subnets,what are the settings (address, gateway, subnet mask) of the firsthost on subnet 300?
  2. Given the CIDR address 155.70.144/20 and a need for 100 subnets,what are the settings of the first host on subnet 3?
Check your answers.


Send email to Guy@ProfessorGuy.com

© Copyright 2000 Guy T. Schafer, Cisco-Certified Network Associate
Last updated January, 2000