PDA

View Full Version : Technical Explanation of Subnetting, please?

bevegan
11-06-2007, 08:11 AM
Funny, I've found this link (http://www.learn-networking.com/design-basics/how-to-subnet-a-network.php) just yesterday and here you come up with this question...

have fun

singularity2006
11-06-2007, 08:25 AM
*wooT!*

u are my savior... looks really promising after a quick skim. Definitely bookmarking that now and going to study for my accounting midterm tonight before I delve into the next one. If anyone else has any interesting links or reference, it would be much appreciated! :scream:

CConcepts
11-06-2007, 10:38 AM
Ok, let me try a short explanation.

The rough idea behind subnetting is to devide the network into several (more or less) subnets. The subnet mask is

used for this division. CIDR describes how to use the currently used 32 Bit wide address range efficiently.

There are three used main classes of nets:

Class A: 255.0.0.0 or /8 has a total amount of 16777216 usable adresses
Class B: 255.255.0.0 or /16 has 65536 addresses
Class C: 255.255.255.0 or /24 has 256 usable adresses

The slash notation is only used if you don't want to write the dotted decimal subnet mask.
192.168.10.0 /24 would be a way to write the host IP address and the mask without having to write the 255.255.255.0 . As you can see, every "quarter" of the mask stands for 8 bits and therefore the whole mask has 32 Bit. To make it

a bit easier and more towards the binary way of writing the whole concept a Class A mask would look like this, if you write it in binary form:

11111111.00000000.00000000.00000000

The slash notation only says who many 1 are in the binary subnet mask. You can use any number behind the slash as

long as it's between 1 and 32 AND you have a complete row of them:

11111111.00000111.00000000.00000000

reads as /8 not /11 because you start from the left counting the 1 till the first 0. I'm not sure if it's even possible to use such a mask so don't waste your time trying it.

If you now want to divide the network into segments to for logical units (for example in a large company where the billing should be seperated from the rest) you have to do subnetting.

Subnetting means that you take some of the remaining bits of the host addresses which are

24 Bits in Class A
16 Bits in Class B
8 Bits in Class C

to create this subnets. The result is that you have less host addresses. For example in a class A net. If you take one bit from the hosts you lover the amount of host bits to 23 which would result in 8388608 host addresses. But remember that the total amount is always the result minus 2 because one IP goes for the broadcast address and another for the subnet address.

So let me give you one whole calculation is it's usual in subnetting.

Imagine that you have the IP and the subnet mask of a host and you have to calculate the following things:

max. host in that subnet

Converting the subnet mask into CIDR notation

255 . 256 . 255 . 240
11111111.11111111.11111111.11110000

If you don't know who to convert decimal to binary send me a message

Next step is to count the bits with the value 1. Keep in mind that you only count to the first 0.

In this case it would be 28 and therefore /28 in CIDR notation

The IP now can be written as 113.8.66.42/28

Max. hosts per net

If you now substract 28 from 32 (max width of the subnet) you'll get 4

2^4 gives 16 which is the theor. max amount of hosts.

16-2=14 because you have to substract 2 hosts, because one is the broadcast address and the other the net address.

Calculation the nett address of the subnet:

First you have to convert the IP into a binary form

113 . 8 . 66 . 42
01110001.00001000.01000010.00101010

To determine the net address you have to take a look on the area of the netmask where the bits are 1 (the connceted

row to the first 0)

IP: 01110001.00001000.01000010.00101010
SN: 11111111.11111111.11111111.11110000

The last 4 zeros of the SN belong to the host.

If you now write a 1 where two 1 are among each other you get this

01110001.00001000.01000010.00100000

which results in 113.8.66.32 which is the net address of the subnet.

To get the broadcast address we have to know how much hosts ar in one subnet.

If you substract 240 (the last value of the subnet) from 256 (2^8 = the max. value of one octett) you get 16.

The first net would be:

IP:113.8.66.33-113.8.66.46
Net: 113.8.66.32
BC:113.8.66.47

If you look on the last 8 bits of the binary IP you see that the row of 1 from the subnet mask divides it into two 4

bit rows. Counted from right to left the bits 1-4 are for the hosts and the bits 5-8 are for the subnet. A broadcast

address is givven if all host bits are 1 and a net address if all are 0.

If you now want to calculate subnets on a given IP you have to do the following things:

IP: 192.168.1.0

If you know that this IP belongs to the private class C network you know that the standard subnet mask is

255.255.255.0

So you have the last octett to subnet your network. The max. hosts for that network without subnetting would be 2^8

or 256.

If you want, for example 4 hosts per subnet with the max. of subnets you have to see how many bits you need to get

the 4 into it:
But remember the minus 2 thing

2^2-2=2
2^3-2=6 (6>4 so this is enough for our task)

You now need 3 bits for the hosts. The last bits are for the subnets which gives you 2^5=32 subnets

The new subnet mask would be

255.255.255.248 because we write the 5 bits from the last IP octett as 1 in the mask which results in:

255 255 255 248
11111111.11111111.11111111.11111000

CIDR would be /29

Now it's easy to calculate the ip ranges, because we know the the subnets are changing every 256-248=8 addresses

(this is what our 2^3 calculation showed)

If you now convert the initial IP into the binary form you'll get

11000000.10101000.00000001.00000000

The first subnet would be from

11000000.10101000.00000001.00000000

to

11000000.10101000.00000001.00000111

which is from

192.168.1.8

to

192.168.1.7

The binary form makes it easier to see how it works:

The last 8 bits of the IP are divided into 5 and 3 bits:

00000|000

If you take the 5 bits in your mind seperate you can start counting the subnets binary

00000 = First subnet
00001 = second
00010 = third
00011 = etc.

vice versa the host bits

000 = first host
001 = second
010 = third
011 = etc.

The first three nets would be this:

Net 1:
IP:192.168.1.1 - 192.168.1.6
BC:192.168.1.7
Net:192.168.1.0

Net 2:
192.168.1.9 - 192.168.1.14
BC:192.168.1.15
Net:192.168.1.8

Net 3:
192.168.1.17 - 192.168.1.22
BC:192.168.1.23
Net:192.168.1.16

Hope that helps a bit. Otherwise feel free to ask

Best wishes
Christoph

Edit: Anybody who finds an error please correct me :)

singularity2006
11-06-2007, 04:19 PM
WOW! Thank you soooo much for taking the time to write that. I'm currently studying for another midterm but did skim through it somewhat. And I did get slightly confused on the whole issue of a partial mask where you have 11111111.11111111.00011111.X. That last part, so that's not a mask and is just the beginning of the address? And if so, what is the range of subnets you can have for that particular mask? Just the number of combinations available for "000," which would be 6? And for each subnet, we have 254 nodes? So the above, would mean 6 subnets with a total of 1524 addresses?

Is that kind of it?

CConcepts
11-07-2007, 05:30 AM
The amount of hosts and subnets depends on the IP you have. So if you are working in a class A net you'll get more nets than in a class C.
If you look on the different classes you see that, if y stands for a number and x can be choosen by you

Class A

IP: yyy.xxx.xxx.xxx
SN:255.xxx.xxx.xxx

Class B

IP: yyy.yyy.xxx.xxx
SN:255.255.xxx.xxx

Class C

IP: yyy.yyy.yyy.xxx
SN:255.255.255.xxx

It's possible that it's an address of a class E network, but these networks are reserved. As i first saw you row I thought that this would be a mask, but then there are no zeros allowed inbetween. It's importnat to have a traight cut between 0 and 1 to do subnetting. The problem then will arise if you calculate the ranges of the subnet in a binary AND operation. If you work with that mask, you'll get a wrong result because only 1 AND 1 = 1 and anything else not.
So please give me a combination of an IP address and subnet mask. Otherwise it wouldn't be possible to calculate the number of subnets and hosts

CGTalk Moderation
11-07-2007, 05:30 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.