Subnetting

From Jaymzworld

Jump to: navigation, search

Contents

Binary Information

converting binary to decimal examples:
128 64 32 16 8 4 2 1: bit values
0 0 0 0 0 0 0 0 = 0
0 0 0 0 1 1 1 1 = 15
1 0 0 0 0 0 1 1 = 131
1 1 1 1 1 1 1 1 = 255

Here is a binary chart that is best just to memorize. You will need to know this off the top of your head as we delve deeper into subnetting.

Bits Binary Decimal
0 00000000 0
1 10000000 128
2 11000000 192
3 11100000 224
4 11110000 240
5 11111000 248
6 11111100 252
7 11111110 254
8 11111111 255

More information to memorize.

Math to memorize:
Subnet Mask Block Size
256 - 128 128
256 - 192 64
256 - 224 32
256 - 240 16
256 - 248 8
256 - 252 4
256 - 254 2
256 - 255 1

IP Address Classes and Ranges

The first bit of the first byte ina Class A network address must always be off, or 0. This means a Class A address must be between 0 and 127.

In a Class B network, the first bit of the first byte must always be turned on, but the second bit must always be turned off. If you turn the other six bits all off and then all on, you will find the range for a Class B network:

  • 10000000 = 128
  • 10111111 = 191

For Class C networks, the first two bits of the first octet are always turned on, but the third bit can never be on.

  • 11000000 = 192
  • 11011111 = 223

Subnet Masks

A subnet mask is a 32-bit value so every machine can distinguish the network ID portion of the IP address from the Host ID portion of the IP address.

The 1s in the subnet mask represent the positions that refer to the network or subnet addresses.

Working with Subnet Masks

  1. Determine the number of required network IDs:
    • One for each subnet
    • One for each wide area network connection
  2. Determine the number of required host IDs per subnet
    • One for each host
    • One for each router interface

When choosing a mask, ensure it provides enough subnets and hosts per subnet. You should be able to answer all of the questions below:

  1. What are the subnets?
  2. What is the broadcast address?
  3. What is the first valid host address?
  4. What is the last valid host address?

Finding the answers

How many subnets?
2x = number of subnets. x is the number of masked bits, or the 1s. For example, 11000000, the number of ones gives us 22 subnets. In this example, there are 4 subnets.
How many hosts per subnet?
2x -2 = number of hosts per subnet. x is the number of unmasked bits, or the 0s. For example, in 11000000, the number of zeros gives us 26 - 2 hosts. In this example, there are 62 hosts per subnet.
What are the valid subnets?
256 - subnet mask = block size, or base number. For example, 256 - 192 = 64. 64 is the first subnet. The next subnet would be the base number itself, or 64 + 64 = 128, (the second subnet).

You keep adding the base number to itself until you reach the value of the subnet mask, which is not a valid subnet because all subnet bits would be turned on.

What's the broadcast address for each subnet?
The broadcast address is all host bits turned on, which is the number immediatedly preceding the next subnet.
What are the valid hosts?
Valid hosts are the numbers between the subnets, minus all 0s and all 1s.

CIDR

CIDR, or Classesless Inter-Domain Routing, is the method that ISPs use to allocate an amount of addresses to a customer. They provide addresses in a certain block size, so when you receive a block of addresses from an ISP, it will look something like this: 192.168.10.32/28.

255.0.0.0 = /8
255.255.0.0 = /16
255.255.255.0 = /24
255.255.255.128 = /25
255.255.255.192 = /26
255.255.255.224 = /27
255.255.255.240 = /28
255.255.255.248 = /29
255.255.255.252 = /30


The slash notation (/) means how many bits are turned on (1s). The maximum could only be /32, but keep in mind that the largets subnet mask available can only be /30 because you've got to keep at least two bits for host bits.

What do you know?

When we see a CIDR or subnet mask, we need to ask "what do we know about this?". For example, what do you know about a /25?

  • 128 mask (10000000)
  • 1 bits on, 7 bits off
  • Block size of 128
  • 2 subnets, 126 hosts

If you can remember this information, subnetting will be a breeze!

Examples

If you have a /26, what do you know?

  • 192 mask (11000000)
  • 2 bits on, 6 bits off
  • Block size of 64
  • 4 subnets, 62 hosts

If you have a /27, what do you know?

  • 224 mask (11000000)
  • 3 bits on, 5 bits off
  • Block size of 32
  • 8 subnets, 30 hosts

If you have a /28, what do you know?

  • 240 mask (11110000)
  • 4 bits on, 4 bits off
  • Block size is 16
  • 16 subnets, 14 hosts

If you have a /29, what do you know?

  • 248 mask (11111000)
  • 5 bits on, 3 bits off
  • Block size is 8
  • 32 subnets, 6 hosts

If you have a /30, what do you know?

  • 252 mask (11111100)
  • 6 bits on, 2 bits off
  • Block size is 4
  • 64 subnets, 2 hosts

Easy Subnetting

  • 192.168.10.0 = Network address
  • 255.255.255.128 = Subnet mask
How many subnets?
Since 128 is one bit on (10000000), the answer would be 21 = 2.
How many hosts per subnet?
We have 7 host bits off (10000000), os the equation would be 27 - 2 = 126 hosts.
What are the valid subnets?
256 - 128 = 128, which is our block size. Our valid subnets are, then, 0 and 128.
What's the broadcast address for each subnet?
The number right before the next subnet is all host bits turned on and equals the broadcast address.
What are the valid hosts?
These are the numbers between the subnets. The easiest way to find the hosts is to write out the subnet address and the broadcast address. This way the valid hosts are obvious.

Very Easy Subnetting

When viewing an IP address and subnet mask, just answer three easy questions:

  • What is the valid subnet?
  • What is the broadcast address?
  • What is the valid host range?
192.168.10.68/26
256 - 192
64 128 Subnet
65 129 First Host
126 190 Last Host
127 191 Broadcast

CIDR Table

Subnet Mask Subnets Hosts Block
/25 128 2 126 128
/26 192 4 62 64
/27 224 8 30 32
/28 240 16 14 16
/29 248 32 6 8
/30 252 64 2 4


Subnetting Questions

Which mask would you assign if you had a class C address with a minimum of 35 hosts per network?

  • Hint: Think block size!

At this point it should be fairly obvious that to get a minimum of 35 hosts you will need at least 6 host bits (25 - 2 gives only 30 hosts). Using six host bits leaves two network bits, and thus a subnet mask of 255.255.255.192.

  • 255.255.255.192 = 62 hosts per subnet
  • 255.255.255.224 = 30 hosts per subnet
  • 255.255.255.240 = 14 hosts per subnet
  • 255.255.255.248 = 6 hosts per subnet
  • 255.255.255.252 = 2 hosts per subnet
How many subnets and hosts?
  • 192.168.10.0/26
    • 2 subnets
    • 62 hosts

You have a Class C address and need 5 usable subnets, each capable of accomodating at least 18 hosts. What is your mask?

  • 255.255.255.224 should be the correct answer, as 3 host bits = 23 = 8 subnets (30 hosts per subnet), while 22 = only 4 subnets.

What are the number of usuable network and host addresses for 222.114.99.0/28?

  • 4 subnets with 14 hosts per subnet and a block size of 16.

You have a class C /28 subnet mask. Which three are valid hosts?

  • 192.168.28.33
  • 192.168.28.112
  • 192.168.28.119
  • 192.168.28.126
  • 192.168.28.175
  • 192.168.28.208
Personal tools
communication