Subnetting And Subnet Mask
Dividing a big network into many smaller networks is called subnetting.
advantages:
privacy.
Example:
we have 200.0.0.0 network address
by seeing first octet we can tell it’s class c,and have 256 hosts,for small network it’s huge right let’s divide the network into 2 subnets.
if we choose one bit from binary we have divided the bits into parts
0 |
---|
1 |
if we choose 2 bits entire bit space divided into 4 parts.
00 |
---|
01 |
10 |
11 |
like wise 3 bits 8 parts (2^3=8)
.
To divide network into 2 parts we need one bit ,so borrow one bit from host id
part1 | part2 |
---|---|
00000000 | 1000000 |
range
subnet1 | subnet2 |
---|---|
00000000 | 10000000 |
01111111 | 11111111 |
0-127 | 128-255 |
now we have 2 subnets one subnet contains 0-127,other 128-255
what is networkid and what is broadcat id if we do subnetting?
if u are inside network u know u done subnetting and u tell nid ,bid of subnets only
if u are outside the network nid,bid used as usual frist and last ip.
subnet mask
32 bit number
series of 1’s represents nid&sid
series of 0’s represents host id
subnet mask for the class c network is 255.255.255.0
subnet mask of classc network in binary binary 11111111.11111111.11111111.00000000
now we borrow 1 bit from host id so our new subnet mask contain 11111111.11111111.11111111.10000000 i.e 255.255.255.128
by using incomming packet router has to identify network to which ip address belongs to
router will take incoming ip and do bitwise and with subnet mask to get nid to which ip belongs to in routing taable.
Routing table
nid | subnet mask | interface |
---|---|---|
200.0.0.0 | 255.255.255.128 | a |
200.0.0.128 | 255.255.255.128 | b |
0.0.0.0 | 0.0.0.0 | c |