Tuesday, September 20, 2011

SUBNETTING COOL WAY!!!!

SUBNETTING COOL WAY!!!!

To know about subnetting we need to first understand the subnet masks and network address

What are these??

Lets learn!

Suppose there is a network address 192.168.1.0 /24

192.168.1.0                  -->This is the network address.
/24 or 255.255.255.0    -->This is the Subnet mask of the above network address.


Let me elaborate more on this.

We have 4 octets in mask ( X . X . X . X )

  |     |      |      | -->  255.255.255.0 (4 octets or 4 bytes technically written)
255    255     255     0

Each byte is made up of 8 bits, since 4 bytes are there above; we multiply 4 bytes into 8 bits, giving us 32 bits in total. (4bytes X 8bits of each byte = 32bits in total)

/24 mask means …

<Out of 32 bits, 24 bits are in Network portion & remaining 8 bits in hosts’ portion>

| | | | | | | | . | | | | | | | | . | | | | | | | |  . | | | | | | |
|-------------Network portion------------|     |--Hosts--|

In same way /16 means 16 bits in networks & 16 bits remaining in hosts.
 /8   means    8 bits in networks & 24 bits in hosts.



WHAT IS SUBNETTING??

Subnetting is the process of breaking down an IP network into smaller sub-networks called "subnets."

Subnetting totally depends on requirement from a company.

Default subnet /24 explanations………..

We have a 192.168.2.0 /24 as given IP network range.
/24 means 8 bits right? YES
So we have | | | | | | | | bits….now lets see how many numbers or hosts can we get from this 8 bits….

To do so, we have to multiply each bits in multiple to

| | | | | | | |           (2^8) – 2 (2n) - 2 = 2 x 2 x 2 x 2 x 2 x 2 x 2 =  256 in total

(256 is the number after the block 0-255, so its should not be considered ever)

So heres is your answer you have total of 254 hosts from /24, reason why it is 254 is because you can not use 1st IP address in subnet and last IP address in the subnet as they are special ip address’s

192.168.2.0 /24           -->  First IP address
192.168.2.255/24        -->  Last IP address

As said special why??? Because

First IP address is the NETWORK ADDRESS OF THAT SUBNET
Last IP address is the BROADCAST ADDRESS OF THAT SUBNET

That’s why formulae also says (2 raise to n) – 2 (these are those for network & broadcast IP’s in subnet)

I Hope you all understood till here, if yes then let’s move ahead.



SUBNETTING I THINK AS

“Making the subnet mask more/greater than the given mask”


Lets play now in 4th octet subnetting which I call.

So lets subnet, we have a requirement which states that we need 26 users or hosts per floor of our building.

Your Manager has given you the IP block – 192.168.2.0 /24

As explained before

In subnet mask, 24 bits are in networks and 8 bits in host, this means or I can say that subnetting is always done using host bits…Remember that!!!!

So we have, | | | | | | | |  --> 8 bits of last octet..

So how we subnet?? Question arises …
Before going ahead, REMEMBER this each bit represent value of  “2”

Lets subnet, YOU HAVE TO USE THOSE NUMBER OF BITS FROM HOST PORTIONS WHICH WILL MAKE WHEN MULTPLYING AS 2 x 2 x 2 x 2..etc  …. WHICH WILL GIVE US 26 OR MORE HOSTS OR NUMBER…….

So out of | | | | | | | |  ---> 8 bits of last octet.

Taking bits for hosts requirements always from right side to left side…

If we take 2 bits from 8, we get 2 x 2 = 4 hosts…this doesn’t work
If we take 3 bits from 8, we get 2 x 2 x 2 = 8 hosts…this doesn’t work
If we take 4 bits from 8, we get 2 x 2 x 2 x 2 = 16 hosts…this doesn’t work

If we take 5 bits from 8, we get 2 x 2 x 2 x 2 x 2 =  32 hosts…yes 32 hosts
Yep!! This works as we have 26 hosts requirement, we fulfill rest free hosts are kept reserved, don’t worry on that

| | | | | | | | . | | | | | | | | . | | | | | | | |  . | | | | | | | |
|-------------Network portion------------|     |--Hosts--|
                                      ---24bits---                            --8bits—
                                      __________3bits pushed________
                           24+3=27
Those Blue bits are used for hosts.so we are left with 3 bits out of 8 in total

Next, what do we do of those 3 bits??? Look above figure

That 3 bits are pushed into network portion, 24 bits already in network portion + 3 bits pushed from host portion making 27 bits in total. That’s the new subnet mask of 192.168.2.0 /27, that’s why I said making
Subnetting I think is “Making the subnet mask more/greater than the given mask”

/24 was given mask, we subnetted and increased its mask by /27 by subnetting..

Now the real parts defining block size and ips.

Block size the number you get after multiplying the bits for your requirement, in this case 32 we got.

So the block size will be 32 each till we reach 254 i.e max an ip address can be.


Elaborating & Explaining….further


Each block, subnet is of 32 hosts or I can say 32 block each till we reach 254

192.168.2.0                         /27
192.168.2.32                    /27
192.168.2.64        /27
192.168.2.96        /27
192.168.2.128      /27
192.168.2.160      /27
192.168.2.192      /27
192.168.2.224      /27
 


Breaking and understanding each subnet now.

Network Address -->
192.168.2.0
/27

Network Address -->
192.168.2.32

192.168.2.1
/27


192.168.2.33

192.168.2.2
/27


192.168.2.34

192.168.2.3
/27


192.168.2.35

192.168.2.4
/27


192.168.2.36
Usable ip addresses
192.168.2.5
/27

Usable ip addresses
192.168.2.37

192.168.2.6
/27


192.168.2.38
192.168.2.1
192.168.2.7
/27

192.168.2.33
192.168.2.39
to
192.168.2.8
/27

to
192.168.2.40
192.168.2.30
192.168.2.9
/27

192.168.2.62
192.168.2.41

192.168.2.10
/27


192.168.2.42

192.168.2.11
/27


192.168.2.43

192.168.2.12
/27


192.168.2.44

192.168.2.13
/27


192.168.2.45

192.168.2.14
/27


192.168.2.46

192.168.2.15
/27


192.168.2.47

192.168.2.16
/27


192.168.2.48

192.168.2.17
/27


192.168.2.49

192.168.2.18
/27


192.168.2.50

192.168.2.19
/27


192.168.2.51

192.168.2.20
/27


192.168.2.52

192.168.2.21
/27


192.168.2.53

192.168.2.22
/27


192.168.2.54

192.168.2.23
/27


192.168.2.55

192.168.2.24
/27


192.168.2.56

192.168.2.25
/27


192.168.2.57

192.168.2.26
/27


192.168.2.58

192.168.2.27
/27


192.168.2.59

192.168.2.28
/27


192.168.2.60

192.168.2.29
/27


192.168.2.61

192.168.2.30
/27


192.168.2.62
Broadcast Address -->
192.168.2.31
/27

Broadcast Address -->
192.168.2.63


In the same way we find for all other IP blocks till the last subnet
192.168.2.224               /27

Always remember a catch now, the answer when we get  multiplying with 2 is always the second subnet of our network space as we got 32 hosts here..

32 here was the second subnet , pls refer above 32 I mean in 4th octet….

192.168.2.0 to 192.168.2.31 ---- was 1st subnet
192.168.2.32 to 192.168.2.63 ---- was 2nd subnet ...

Till last subnet 192.168.2.224 – 192.168.2.255 ---- last subnet, whose usable ip address range is from 192.168.2.224 to 192.168.2.254, in above case network address is 192.168.2.224 /27 and broadcast ip address is 192.168.2.254 /27…

Remember each subnet has its own network ip address and broadcast ip address, remaining ips between these are usable ip address of that subnet block!!

A NEW REQUIREMENT………

Folks in same way you can also subnet for number of networks if you have 10 locations and they need an IP block form existing range given

192.168.2.0 /24 …..

Now we need for 10 location networks right? Then simply remove the bits in multiple of 2’s but this time from LEFT SIDE to RIGHT SIDE..till we reach 10 or more

So in this case

| | | | | | | | . | | | | | | | | . | | | | | | | |  . | | | | | | | |
|-------------Network portion------------|     |--Hosts--|
                                      ---24bits---                            --8bits—
                                      __________4bits pushed________
                           24+4=28
We take 4 bits from left, and push those into network
  2 x 2 x 2 x 2 = 16 bits , 10 we can use and 6 we can keep reserved




REMEMBER BITS FROM HOST ARE ALWAYS PUSHED IN NETWORK PORTION



Now we subnet and see, 192.168.2.0 /28 new mask and block size is of  16bits now…

So our ip blocks will be or subnets will be

192.168.2.0
/28
192.168.2.16
/28
192.168.2.32
/28
192.168.2.48
/28
192.168.2.64
/28
192.168.2.80
/28
192.168.2.96
/28
192.168.2.112
/28
192.168.2.128
/28
192.168.2.144
/28
192.168.2.160
/28
192.168.2.176
/28
192.168.2.192
/28
192.168.2.208
/28
192.168.2.224
/28
192.168.2.240
/28

Hope you know how to remove network ip address, broadcast ip address and Usable ip addresses of each block…..

Folks this was the subnetting done in 4th octet, In the same way I will be soon writing up….3rd and 2nd octet subnetting


Thanks for reading. Let me if any mistakes or typos!!!!
You can post queries at  Comments..

No comments:

Post a Comment

Dear Reader, if you like My Blog content, feel free to comment on our blog posts.