# Subnet

May 22nd, 2007

Hi,

I keep unable to understand on subnet topic.

How to interpret these for example:

192.168.1.2 255.255.255.0

and

192.168.1.70 255.255.255.224 ?

Why the subnet mask last octet is difference?

Thanks for help to understand.

Overall Rating: 4.6 (5 ratings)

## Replies

mohammedmahmoud Tue, 05/22/2007 - 23:23

Hi,

The subnet mask identifies the portion of the IP address that belongs to the network/subnet ID and the portion that belongs to the host ID, for example:

192.168.1.2 255.255.255.0, means that the network ID is 192.168.1.0/24 (/24 = 255.255.255.0), and that you can have host IPs from 192.168.1.1 to 192.168.1.254.

Similarly, 192.168.1.70 255.255.255.224, means that the network ID is 192.168.64/27 (/27 = 255.255.255.224), and that you can have host IPs from 192.168.1.65 to 192.168.1.94.

Kindly use the following document for further info:

http://www.3com.com/other/pdfs/infra/corpinfo/en_US/501302.pdf

Mohammed Mahmoud.

kokbeng.lim Wed, 05/23/2007 - 00:48

Thanks for the explanation. But how do you derive /27? and how you get the range from 192.168.1.65 to 192.168.1.94 ?

Jon Marshall Wed, 05/23/2007 - 01:14

Hi

You really need to work in binary for this to make sense.

255.255.255.0 = 11111111.11111111.11111111.00000000

Subnet mask defines the network so you can tell from the above that the first 3 octets ie. 192.168.1 are the network. The last octet is used for hosts.

255.255.255.224 = 11111111.11111111.11111111.11100000

So the first 3 octets + the first 3 bits of the last octet are used as part of the network.

Ech octet can be defined as 8 bits. So in the first example above 8 x 3 = 24 which mean your subnet mask is 255.255.255.0.

In the second example you have

8 + 8 + 8 + 3 = 27.

As for the range

1) Look at the last 3 bits in the last octet.

The first bit = 128

The second bit = 64

the third bit = 32

add these together and you get 224 which is the last network part of your subnet mask.

The last bit for the network is 32 so your networks go up in 32's.

so

first network = 192.168.1.0

second network = 192.168.1.32

third network = 192.168.1.64

fouth network = 192.168.1.96

Hope all this makes sense

Jon

mohammedmahmoud Wed, 05/23/2007 - 01:15

Hi,

The subnet mask is 32 bit, the slash notation (/27) reflects the number of bits set to one in the subnet mask:

Example:

/8 = 11111111.0000000.0000000.0000000

/27 = 11111111.11111111.1111111.11100000

when you convert the above binary to decimal. /27 = 255.255.255.224 (check the document that i've sent you for binary to decimal conversion).

As for subnetting, as a simple example, if we need to subnet the class C network 192.168.1.0 to multiple 32 IP subnets:

192.168.1.0/27

192.168.1.32/27

192.168.1.64/27

192.168.1.96/27

192.168.1.128/27

192.168.1.160/27

192.168.1.192/27

192.168.1.224/27

But note that every 32 IP subnet can have only 30 usable IPs, the all zeros is the subnet ID and the all ones is the subnet broadcast IP, thus for the third subnet the usable IPs are from 192.168.1.65 to 192.168.1.94.

Please don't hesitate for any further questions.

Mohammed Mahmoud.

kokbeng.lim Thu, 05/24/2007 - 00:20

Hi

probing futher on, I tried to sort out what is reason for using different subnet mask example 255.255.255.0 and 255.255.255.224 but not able to figure out. Pls help me to understand in what situation do different subnet masks are apply?

Jon Marshall Thu, 05/24/2007 - 00:25

Hi

It all depends on how many useable addresses you need. So for example

192.168.1.0 255.255.255.0 gives you 254 useable address ie 192.168.1.1 -> 192.168.1.254 with 192.168.1.255 being the broadcast address.

Now say you need a vlan but you only need 28 useable addresses. If you use the above subnet you "waste" an awful lot of addresses.

192.168.1.0 255.255.255.224

This gives you 30 useable addresses ie.

So you generally pick subnet masks to match the number of hosts you need. Always allow room for growth though as there is nothing worse than having to readdress a whole subnet because you ran out of addresses.

HTH

Jon

mohammedmahmoud Thu, 05/24/2007 - 00:39

Hi,

Jon has explained it perfectly, but just to add, this is called VLSM, Variable Length Subnet Mask (VLSM) is a means of allocating IP addressing resources to subnets according to their individual need rather than some general network-wide rule, in order for good utilization of the address space.