Subnet mask
Subnet mask is a 32 bits long
address used to distinguish between network address and host address in IP
address. Subnet mask is always used with IP address. Subnet mask has only one
purpose, to identify which part of an IP address is network address and which
part is host address.
For example how will we
figure out network partition and host partition from IP address 192.168.1.10 ?
Here we need subnet mask to get details about network address and host address.
· In
decimal notation subnet mask value 1 to 255 represent network address and value
0 [Zero] represent host address.
· In
binary notation subnet mask ON bit [ 1] represent network address while OFF
bit[0] represent host address.
In decimal notation
IP address 192.168.1.10
Subnet mask 255.255.255.0
Network address is 192.168.1
and host address is 10.
In binary notation
IP address
11000000.10101000.00000001.00001010
Subnet mask
11111111.11111111.11111111.00000000
Network address is
11000000.10101000.00000001 and host address is 00001010
IP Class
|
Default
Subnet
|
Network
bits
|
Host
bits
|
Total
hosts
|
Valid
hosts
|
A
|
255.0.0.0
|
First 8
bits
|
Last 24
bits
|
16,
777, 216
|
16,
777, 214
|
B
|
255.255.0.0
|
First
16 bits
|
Last 16
bits
|
65,536
|
65,534
|
C
|
255.255.255.0
|
First
24 bits
|
Last 8
bits
|
256
|
254
|
Network ID
First address of subnet is
called network ID. This address is used to identify one segment or broadcast
domain from all the other segments in the network.
Block Size
Block size is the size of
subnet including network address, hosts addresses and broadcast address.
Broadcast ID
There are two types of
broadcast, direct broadcast and full broadcast.
Direct broadcast or local
broadcast is
the last address of subnet and can be hear by all hosts in subnet.
Full broadcast is the last address of IP
classes and can be hear by all IP hosts in network. Full broadcast address is
255.255.255.255
The main difference between
direct broadcast and full broadcast is that routers will not propagate local
broadcasts between segments, but they will propagate directed broadcasts.
Host Addresses
All address between the
network address and the directed broadcast address is called host address for
the subnet. You can assign host addresses to any IP devices such as PCs,
servers, routers, and switches.
Subnetting
Subnetting is a process of
breaking large network in small networks known as subnets. Subnetting happens
when we extend default boundary of subnet mask. Basically we borrow host bits
to create networks. Let's take a example
Being
a network administrator you are asked to create two networks, each will host 30
systems.
Single class C IP range can
fulfill this requirement, still you have to purchase 2 class C IP range, one
for each network. Single class C range provides 256 total addresses and we need
only 30 addresses, this will waste 226 addresses. These unused addresses would
make additional route advertisements slowing down the network.
With subnetting you only need
to purchase single range of class C. You can configure router to take first 26
bits instead of default 24 bits as network bits. In this case we would extend
default boundary of subnet mask and borrow 2 host bits to create networks. By
taking two bits from the host range and counting them as network bits, we can
create two new subnets, and assign hosts them. As long as the two new network
bits match in the address, they belong to the same network. You can change
either of the two bits, and you would be in a new subnet.
Advantage of Subnetting
· Subnetting
breaks large network in smaller networks and smaller networks are easier to
manage.
· Subnetting
reduces network traffic by removing collision and broadcast traffic, that
overall improve performance.
· Subnetting
allows you to apply network security polices at the interconnection between
subnets.
· Subnetting
allows you to save money by reducing requirement for IP range.
Subnetting math
Subnetting process involves
binary math calculation. Computers communicate with each other's in binary
language. To succeed in any kind of networking career, you might be fluent in
binary math calculation. Subnetting needs two type of calculation, convert
decimal to binary and convert binary to decimal.
Binary system works exactly
same as decimal system, except the base number. Base number is 2 in binary
system and 10 in decimal system. To calculate decimal equivalent value of a
binary number, you have to replace base value 10 with 2. Binary numbers are displayed
in columns and each position in binary system has double value than the
position in right. From earlier section of this article you know that each
number of an IP address is made from eight individual bits known as octet. So
you should remember at least eight decimal equivalent value from binary
position.
Base position
|
27
|
26
|
25
|
24
|
23
|
22
|
21
|
20
|
Decimal
value
|
128
|
64
|
32
|
16
|
8
|
4
|
2
|
1
|
Convert decimal to binary
To convert a decimal number
in binary we would use addition till number method. In this method we start
adding from left to get target value. If after adding right position value, sum
is lower than target number, keep adding, or if sum is greater than target
number skip the position value. Only the value of on bit [1] will be added in
sum. Off bit [0] has zero value. For example, convert decimal number 117 in
binary.
Target decimal number 117
Move direction From Left
===========================> to Right
Base position
|
27
|
26
|
25
|
24
|
23
|
22
|
21
|
20
|
Decimal
value
|
128
|
64
|
32
|
16
|
8
|
4
|
2
|
1
|
Bit status
|
0
|
1
|
1
|
1
|
0
|
1
|
0
|
1
|
Decimal
value in addition
|
0
|
64
|
32
|
16
|
0
|
4
|
0
|
1
|
Binary value of 117 is
01110101.
Decimal calculation
|
Bit in
binary
|
128 is
greater than 117
|
off the
bit
|
0+64 =
64 is less than 117
|
on the
bit
|
0+64+32
= 96 is less than 117
|
on the bit
|
0+64+32+16
= 112 is less than 117
|
on the
bit
|
0+64+32+16+8
= 120 is greater than 117
|
off the
bit
|
0+64+32+16+0+4
= 116 is less than 117
|
on the
bit
|
0+64+32+16+0+4+2
= 118 is greater than 117
|
off the
bit
|
0+64+32+16+0+4+0+1
= 117 is equivalent to 117
|
on the
bit
|
Convert binary in decimal
To convert a binary in
decimal we will follow above method in reverse mode. We will find the decimal
value of on binary bit position and add them. For example convert 10101010
binary number in decimal.
Target binary number 10101010
Move direction From Left
===========================> to Right
Base position
|
27
|
26
|
25
|
24
|
23
|
22
|
21
|
20
|
Decimal
value
|
128
|
64
|
32
|
16
|
8
|
4
|
2
|
1
|
Bit
status
|
1
|
0
|
1
|
0
|
1
|
0
|
1
|
0
|
Decimal
value in addition
|
128
|
0
|
32
|
0
|
8
|
0
|
2
|
0
|
Decimal value of 10101010 is
170 [ 128+0+32+0+8+0+2+0 ]
Binary bit
|
Decimal
value
|
1 On
bit
|
128
|
0 Off
bit
|
0
|
1 On
bit
|
64
|
0 Off
bit
|
0
|
1 On
bit
|
32
|
0 Off
bit
|
0
|
1 On
bit
|
8
|
0 Off
bit
|
0
|
1 On
bit
|
2
|
0 Off
bit
|
0
|
Review above method and do as
much practice of following as you can.
· Pick
any number from 0 - 255 and convert it in binary.
· Pick
any combination from 00000000 - 11111111 and convert it in decimal.
Better you are with this
conversion, the better you will do on the subnetting.
Combination provided by binary position
Now you know the process of
converting binary in decimal and decimal in binary. Our next step is to figure
out the combination provided by a binary position.
First bit provide two
combination 0 or 1. If we take two bits than we have four combinations
00,01,10,11. IP address has 32 bits, so you should be able to find the number
of combinations provided by each bit position until position number 32.
Number of bit[s]
|
Number
of combinations
|
Number
of bits
|
Number
of combinations
|
1
|
2
|
17
|
131072
|
2
|
4
|
18
|
262144
|
3
|
8
|
19
|
524288
|
4
|
16
|
20
|
1048576
|
5
|
32
|
21
|
2097152
|
6
|
64
|
22
|
4194304
|
7
|
128
|
23
|
8388608
|
8
|
256
|
24
|
16777216
|
9
|
512
|
25
|
33554432
|
10
|
1024
|
26
|
67108864
|
11
|
2048
|
27
|
134217728
|
12
|
4096
|
28
|
268435456
|
13
|
8192
|
29
|
536870912
|
14
|
16384
|
30
|
1073741824
|
15
|
32768
|
31
|
2147483648
|
16
|
65536
|
32
|
4294967296
|
Default subnet mask
Class
|
Subnet
Mask
|
Format
|
A
|
255.0.0.0
|
Network.Host.Host.Host
|
B
|
255.255.0.0
|
Network.Network.Host.Host
|
C
|
255.255.255.0
|
Network.Network.Network.Host
|
No comments:
Post a Comment