Key terms to remembers
· A
subnet is a smaller portion of large network treated as its own separate
network. To create subnet we borrow bits from host portion and assign them as network
bits. This mean more networks, fewer hosts.
· If
the network bits on two addresses do not match, then the two packets are
intended for two separate networks.
· On
a 32 bits IP address at least eight bits must belong to the network portion and
at least 2 bits must belong to the host portion.
· Each
IP address has a predefined IP class and that cannot be changed.
· Each
class has a predefined default subnet mask that tell us the octets, which are
already part of the network portion, as well as how many bits we have available
to work with.
· Whatever
network class is it, we cannot change those bits that are already assigned.
· We
cannot assign the network ID and the broadcast address to a host.
· Regardless
how many bits are left in the host field, network ID and the broadcast address
must be reserved.
· Subnet
bits start at the left and go to the right, without skipping bits.
CIDR [ Classless Inter Domain
Routing]
CIDR is a slash notation of
subnet mask. CIDR tells us number of on bits in a network address.
· Class
A has default subnet mask 255.0.0.0. that means first octet of the subnet mask
has all on bits. In slash notation it would be written as /8, means address has
8 bits on.
· Class
B has default subnet mask 255.255.0.0. that means first two octets of the
subnet mask have all on bits. In slash notation it would be written as /16,
means address has 16 bits on.
· Class
C has default subnet mask 255.255.255.0. that means first three octets of the
subnet mask have all on bits. In slash notation it would be written as /24,
means address has 24 bits on.
Method of subnetting
In subnetting we find the
answer of following questions.
· What
is subnet mask for given address?
· How
many subnets does given subnet mask provide ?
· What
is block size for given subnet mask?
· What
are the valid subnets?
· What
are the total hosts?
· How
many valid hosts are available per subnet?
· What
is broadcast address of each subnet?
· What
is network address of each subnet?
To answer above questions we
use following method of subnetting.
What is subnet mask for given
address?
Subnetting take places when
we extend the default subnet mask. We cannot perform subnetting with default
subnet mask and every classes have default subnet mask. To figure out subnetted
subnet mask ,we first need to write down the default subnet mask. Now find the
host bits borrowed to create subnets and convert them in decimal. For example
find the subnet mask of address 188.25.45.48/20 ? This address belong to class
B and class B has default subnet mask 255.255.0.0[ /16 in CIDR ]. We borrowed 4
bits from hosts portion. As you know subnetting move from left to right and it
cannot skip any network bit. So this subnet mask in binary would be 11111111.
11111111.11110000.00000000. First two octet have default value so its decimal
value would be 255.255. We will convert third octet in decimal value. To
convert a binary number in decimal we add its decimal equivalent value. In our
example it would be 128+64+32+16+0+0+0+0 = 240. Our fourth octet has all bits
off so its decimal value would be 0+0+0+0+0+0+0+0 =0. Our answer subnet mask
would be 255.255.240.0
How many subnets does given
subnet mask provide ?
To calculate the number of
subnets provided by given subnet mask we use 2N , where N = number
of bits borrowed from host bits to create subnets. For example in 192.168.1.0/27,
N is 3. By looking at address we can determined that this address is belong to
class C and class C has default subnet mask 255.255.255.0 [/24 in CIDR]. In
given address we borrowed 27 - 24 = 3 host bits to create subnets. Now 23
= 8, so our answer is 8.
What is block size for subnet
mask?
Block size or increment
number is used to calculate the valid subnets. Once you figure out the block
size, calculation of valid subnets become piece of cake. To figure out the
block size, use this formula 256 - Subnet mask = block size. For example block
size for subnet mask 255.255.255.240 is 256 - 240 = 16.
What are the valid subnets?
Calculating valid subnet is
two steps process. First calculate total subnet by using formula 2N.
In second step find the block size and count from zero in block until you reach
the subnet mask value. For example calculate the valid subnets for
192.168.1.0/26.
Borrowed host bits are 2
[26-24].
Total subnets are 22 = 4.
Subnet mask would be 255.255.255.192.
Block size would be 256-192 = 64.
Start counting from zero at blocks of 64, so our valid subnets would be 0,64,128,192.
Total subnets are 22 = 4.
Subnet mask would be 255.255.255.192.
Block size would be 256-192 = 64.
Start counting from zero at blocks of 64, so our valid subnets would be 0,64,128,192.
What are the total hosts?
Total hosts are the hosts
available per subnet. To calculate total hosts use formula 2H =
Total hosts. H is the number of host bits. For example in address
192.168.1.0/26 we have 32 - 26 [Total bits in IP address - Bits consumed by
network address] = 6. Total hosts per subnet would be 26 = 64.
How many valid hosts are
available per subnet?
Valid hosts are the number of
hosts those can be assigned to devices. As we know, we need to reduce two
address per subnet, one for network ID and another for broadcast ID. So our
formula, to calculate valid hosts would be Total hosts - 2 = Valid hosts. In
above example we have 64 hosts per subnet, so valid hosts in each subnet would
be 64 - 2 = 62.
What is broadcast address of
each subnet?
Broadcast address is the last
address of subnet. This address is reserve for network broadcast, and cannot be
assigned to any host. In above example
0 Subnet has broadcast
address 63
64 Subnet has broadcast address 127
128 Subnet has broadcast address 191
192 Subnet has broadcast address 255
64 Subnet has broadcast address 127
128 Subnet has broadcast address 191
192 Subnet has broadcast address 255
What is the network address
of each subnet?
Network address is the first
address of subnet. This address is used to locate the network, and cannot be
assigned to any host. In above example address 0,64,128,192 are the network
address.
· Network
address is always the first IP address of subnet.
· Broadcast
address is always the last IP address of subnet ( IP address before the next
subnet).
· Valid
hosts are the IP addresses between network address and broadcast address.
At this point you have
powered with all essential tools for subnetting. In last section of this
article we will practically implement what we have learn so far. Due to length
of this article I will include examples only from class C.
Class C Subnetting
Default subnet mask of class
C is 255.255.255.0. CIDR notation of class C is /24, which means 24 bits from
IP address are already consumed by network portion and we have 8 host bits to
work with. We cannot skip network bit, when we turned them on. Subnetting moves
from left to right. So Class C subnet masks can only be the following:
CIDR
|
Decimal
|
Binary
|
/25
|
128
|
10000000
|
/26
|
192
|
11000000
|
/27
|
224
|
11100000
|
/28
|
240
|
11110000
|
/29
|
248
|
11111000
|
/30
|
252
|
11111100
|
As we have already discussed
earlier in this article that we have to have at least 2 host bits for assigning
IP addresses to hosts, that means we can't use /31 and /32 for subnetting.
/25
CIDR /25 has subnet mask
255.255.255.128 and 128 is 10000000 in binary. We used one host bit in network
address.
N = 1 [Number of host bit
used in network]
H = 7 [Remaining host bits]
Total subnets ( 2N ) :- 21 = 2
Block size (256 - subnet mask) :- 256 - 128 = 128
Valid subnets ( Count blocks from 0) :- 0,128
Total hosts (2H) :- 27 = 128
Valid hosts per subnet ( Total host - 2 ) :- 128 - 2 = 126
H = 7 [Remaining host bits]
Total subnets ( 2N ) :- 21 = 2
Block size (256 - subnet mask) :- 256 - 128 = 128
Valid subnets ( Count blocks from 0) :- 0,128
Total hosts (2H) :- 27 = 128
Valid hosts per subnet ( Total host - 2 ) :- 128 - 2 = 126
Subnets
|
Subnet
1
|
Subnet
2
|
Network
ID
|
0
|
128
|
First
host
|
1
|
129
|
Last
host
|
126
|
254
|
Broadcast
ID
|
127
|
255
|
No comments:
Post a Comment