26292 total geeks with 3498 solutions
Recent challengers:
 Welcome, you are an anonymous user! [register] [login] Get a yourname@osix.net email address 

Articles

GEEK

User's box
Username:
Password:

Forgot password?
New account

Shoutbox
MaxMouse
It's Friday... That's good enough for me!
CodeX
non stop lolz here but thats soon to end thanks to uni, surely the rest of the world is going good?
stabat
how things are going guys? Here... boring...
CodeX
I must be going wrong on the password lengths then, as long as it was done on ECB
MaxMouse
lol... the key is in hex (MD5: of the string "doit" without the "'s) and is in lower case. Maybe i should have submitted this as a challenge!

Donate
Donate and help us fund new challenges
Donate!
Due Date: May 31
May Goal: $40.00
Gross: $0.00
Net Balance: $0.00
Left to go: $40.00
Contributors


News Feeds
The Register
Phones for the
elderly: Testers
wanted for senior
service
Lego X-wing fighter
touches down in New
York"s Times Square
Experts: Network
security
deteriorating,
privacy a lost
cause
Internet cafés
declared "illegal
businesses" in Ohio
SAP shuffles execs
to chase cloud
success
AT&T adds 61˘
"Mobility
Administrative Fee"
for users
Microsoft caves to
Google, pulls
YouTube app from
WinPhone Store
Amazon expands
Appstore reach,
gives devs more
user data
Now it gets
serious: Fracking
could RUIN BEER
Reports: New Xbox
could DOOM
second-hand games
market
Slashdot
World"s Biggest
"Agile" Software
Project Close To
Failure
Google Unable To
Keep Paying App
Developers In
Argentina
Ex-Marine Detained
Under Operation
Vigilant Eagle For
His Political Views
Sues
European Commission
Launches $12
Billion Chip
Support Campaign
Scanner Identifies
Malware Strains,
Could Be Future of
AV
AMD Launches New
Mobile APU Lineup,
Kabini Gets Tested
How To Hack
Twitter"s
Two-Factor
Authentication
African Soil Mapped
For the Very First
Time
BeagleBone Black
Ships With New
Linux 3.8 Kernel
Google Releases
Glass Factory
System Image,
Rooted Bootloader
Article viewer

Subnetting, the mystery explained!



Written by:dimport
Published by:Nightscript
Published on:2003-06-21 07:19:46
Topic:Networking
Search OSI about Networking.More articles by dimport.
 viewed 42244 times send this article printer friendly

Digg this!
    Rate this article :
This is a fairly straightforward introduction into subnetting. Shows, using a simple example how to implement a subnet on a class b network.

What is subnetting?
Well, subnetting is basically just splitting an existing network into small, more manageable networks. It is done by using simple bit borrowing from the host part of the IP address, which is explained later.

Why do we need to subnet?

To avoid huge data overhead on networks, and to increase network efficiency.

Tell me more!

Well, a standard IP address looks like x.x.x.x where x is a variable number ranging from 1-254, It is better understood when broken down into binary. The IP address 1.1.1.1 would convert to 00000001.00000001.00000001.00000001 in binary. Now, the determinination of destination of data is based on the network and host address.

Before we talk about network and host addresses we can look at the above as 4 octets of binary, this is an explanation of the terminology used later. There are three types of network types used in IPV4 (current implementation of IP, further tutorials on IPV6 will be written soon), these networks are class A, class B, and class C. A class A network is any network where the first bit of the first octet is a 0, a class B network is any network where the first two bits in the octet are 10, and a class C network is any network where the first three bits in the octet are 110. There is too much to go into for why there is this addressing scheme, and beyond the scope of this small tutorial. So we now have an understanding of the different classes of network, and how to define them. Let's get on with subnetting. We will use a class B network as the example for the subnetting used in this tutorial, but the same theory applies to all classes of network, though, if you have any questions, just post them in the forum. So let's have a look at a simple class B network.

156.1.0.0 – This is an IP address of a class B network.
10011100.00000001.00000000.00000000 – This is the binary notation of the IP address.

The network address of a class B network is the first 16 bits (first two octets), then the remaining 16 bits (last two octets) are for the host address. For class A networks the first 8 bits are used for the host address, and for class C networks the first 24 bits are used for the host address.

So we can see that 10011100.00000001 is the network address, and 00000001.00000001 is the host address. This is where subnetting comes in, which simply put is borrowing bits from the host address to increase the number of networks. Let's say we want to borrow 5 bits from the host address two increase the number of networks, we end up with 10011100.00000001.00000 as the network address and 001.00000001 as the host address. A word of warning at this point, well advice really; try and keep everything in binary, it is much easier to understand. Leave the conversion to decimal right to the end. So we now have 16+5 bits for the address which means we have 11 bits for the host address. This borrowing to create more networks is called subnetting. Let's take a look at the host ranges for the subnets we have created.

We have borrowed 5 bits, leaving us with 3 bits for the ranges of hosts in each subnet. So converted to decimal (because I'm nice like that) we have : -

156.1.0.0 – 156.1.7.255 – This is the first ranges of usable host addresses in the subnets we have just created.

156.1.8.0 – 156.1.15.255 – This is the second set of usable host address in the subnets.

OK, we have created our subnet, gotten the ranges of usable IP address, but how do we tell the machine about our new addressing system?

We use what's called an extended network prefix, also known as the subnet mask. This is found by converting one of our subnet addresses into binary (we'll use 156.1.0.0)
which looks like this:

10011100.00000001.00000000.00000000 -Now we must convert all of the network bits to one which look like this:

11111111.11111111.11111000.00000000 -Now we turn all of the hosts bits to zero (already done), now we convert this back into decimal.

255.255.248.0 – And this is our subnet mask for the subnets we have just created.

We have now created a subnet from a class B address and created the mask for it, and also found the working host ranges. I know it seems difficult at first, but it does get easier. Just keep playing around. The nature of computers is calculated experimentation, so go out and give it a go.

If you have any questions or comments post them on the forum, and I will try my best to answer them, time allowing of course.

This article was originally written by sliptop

Did you like this article? There are hundreds more.

Comments:
Anonymous
2006-12-16 15:20:12
was good but how many subnetts can you have thenn from thge example given
Domuk
2006-12-16 15:30:22
I like http://www.osix.net/modules/article/?id=495 , myself
Anonymous
2007-01-11 14:45:31
You explained the math behind subnetting, but you never explained what it was used for. A more in-depth explanation of this would be more useful.
Anonymous
2008-10-21 11:49:29
The small paragraph were you explain about network portions, class B is correct.

Please check Class A&C, you nominate the network portion as hosts.
Anonymous
2008-10-26 01:07:10
this suck, your explanation doesn't lead anywhere....
Anonymous
2009-01-22 13:19:35
i still dont get it
Anonymous
2009-01-25 20:16:47
I also dont understand this as first and second set of usable address ranges make no sense to me. Surely 5 bits would be adding up 128 + 64 + 32 + 16 + 8. Makes no sense at all.
Anonymous
2009-02-25 12:29:06
Hi,

How do you borrow 5 bits from the host if it's all 0's?
would it not be
10011100.00000001- network.11000000.11100000- host
Anonymous
2009-02-25 12:29:40
above reply to carl.pearce@yahoo.co.uk
Anonymous
2009-10-07 16:07:57
It helped me understand it
Anonymous
2010-02-09 08:32:48
after borrowing bits from HOST ADDRESS...how did we get one at last..i.e001.00000001 (((if possible/if don't possible plz send the answer to senoritasruthi@rediffmail.com
Anonymously add a comment: (or register here)
(registration is really fast and we send you no spam)
BB Code is enabled.
Captcha Number:


Blogs: (People who have posted blogs on this subject..)
everyMan
Blog entry for Thu 1st Feb 1am on Thu 1st Feb 2am
I need to write "run.pl" that calls expect script. the expect will the take the user and pass given in run.pl and telnet to another device.

Test Yourself: (why not try testing your skill on this subject? Clicking the link will start the test.)
Hubs / Switches & Cable Wires/Wireless by DocHoliday

This test is revolved around networking with hubs and of course switches in which are performed to create a network route.
Beginning Networking by truthseeker

Basic, beginning networking test. Covers a little of everything, protocols, hardware, OSI model, etc.
Networking by emmanuelmalanda

simple exercise to test one's knowledge on various networking aspects
Various Networking (part 2) by think12

Started as a Ethernet based test, but... It grew a mind of its own
Various Networking (pt1) by think12

Mainly protocols


     
Your Ad Here
 
Copyright Open Source Institute, 2006