It appears that you're running an Ad-Blocker. This site is monetized by Advertising and by ">User Donations; we ask that if you find this site helpful that you whitelist us in your Ad-Blocker, or make a ">Donation to help aid in operating costs.
Previous Thread
Next Thread
Print Thread
Rate This Thread
#2295 - 04/02/03 01:18 AM An Introduction to Subnetting  
Joined: Mar 2002
Posts: 1,041
Infinite Offline
UGN Elite Poster
Infinite  Offline
UGN Elite Poster

Joined: Mar 2002
Posts: 1,041
Canada eh
We were talking about this in IRC the other day so I thought I'd write up a explanation for anyone who would care to know a little more.

I'm going to assume here that you already know how binary works, and can perform some simple

converion either in your head or on paper. I'm also assuming that you know the difference

between a class A, B, and C IP address.

The purpose of a subnetting is to make more logical divisions (subnetworks) out of a given

IP address range. In a class A network, there are 126 useable networks, and 16777214 hosts

per network. Kinda ridiculous and defineatly not very useful. To address this problem the

practice of subnetting was put into use. Every host on every network must have an

appropriate subnet mask or it can not comunicated on the network. To acheive the additional

networks, bits are 'borrowed' from the host portion of the address.

Looking at IP addresses in the dotted decimal format, the network vs. hosts bits are broken

down like this:

class A -- N.H.H.H
Class B -- N.N.H.H
class C -- N.N.N.H

The network number for a network always has the hosts bits turned off (o). As well, the

address for every host on the network is when all host bits are turned on (1).

So, let's take a look at what exactly an IP address is. An IP address is a 32 bit binary

string that is used to identify a host on a network. For readibility's sake, this string is

commonly represented as a dotted decimal quad that looks something like:

But keep in mind, this is what it really looks like:


Well, this doesnt look fun at all now does it. That is what IP looks like to a router or a

host, so we must too.

Now let's look at a default subnet mask for our above example class C IP address:

Which in binary is:


To get the network address from these two numbers, the numbers are AND'ed together






Convert this into our dotted decimal notation and we have:

This number is used by routing protocols to identify this network among other network on a

LAN or WAN. But what does this all mean? This means that our example IP belongs to the

132nd host on the network it also means that there are a possible 254 hosts

on that same network.

But, what if the subnetmask was not Let's say the subnet mask is instead. Performing the AND'ing again we get:






Whoa! In our dotted decimal that makes as the network number! So now our

address is the 4th host on network, out of a possible 126. And because this

is now a subnetted address, the network is actually the second of two subnetworks.

As mentioed above, a class C address uses the final 8 bits to represent the host portion of

an address. With our example subnet of we borrowed 2 bits, giving us two

usable subnets. The formula to figure out the useable hosts or subnets it to raise 2 to the

number of bits available and minus 2 ((2^n)-2)). With our example we have:




Giving us 2 useable subnets (the first is the network number, the last is the broadcast,

hence the minus 2. As well, when subnetting you may not borrow 1 bit, or leave 1 bit for

the host portion. At least two bits must occupy either network or host portion at all


For the hosts we have 6 bits:




62 useable host addresses per subnet. Now wait a moment... With our default subnet we had

one network with two hundred and fifty-four hosts, now we have two networks with sixty-two

hosts per subnetwork? Where did the other 132 hosts addresses go?!?! This is the downside

to subnetting. While you lose available host addresses, the benefits of subnetting far

outweigh this and is well beyond how much detail I want to go into =.

Let's looks at a little more complicated example. We want to find the network number, host

number for this IP, total number of subnets, and total number hosts:


first we do a binary AND:






Into dotted decinal we have a network number of This means that our host is number

5520 on this network! To finish the question, it's a class A network so we borrowed 10 bits:



1022 Subnets

And we left 14 bits in the host portion:



16382 Hosts

Now that we can find a subnet, let's make some. Let's say we want to subnet the class B

address of into a minimum of 325 subnetworks. Using the above formula:

(2^8)-2 = 254 too low

(2^9)-2 = 512 OK

So if we are to borrow 9 bits then our subnet mask is But let's look at

how we arrive at our network numbers by using binary again. We start with the address of, which gives the following meaning to the bits:


Because this is an assigned address, we cannot change the first two octets. knowing those

are constant we have a subnet range of 172.15.0 - 172.15.255 . in binary this is:

172.15.00000000 - 172.15.11111111

To get get our subnetwork numbers we count up the subnetwork bits in binary one at a time:

Binary -- Decimal

172.15.000000000|0000000 -- (unuseable)
172.15.000000001|0000000 --
172.15.000000010|0000000 --
172.15.000000011|0000000 --
172.15.000000100|0000000 --
172.15.000000101|0000000 --


172.15.111111011|0000000 --
172.15.111111100|0000000 --
172.15.111111101|0000000 --
172.15.111111110|0000000 --
172.15.111111111|0000000 -- (unuseable)

And likewise, in any given subnetwork we count up each host bit to get the host numbers:

Binary -- Decimal

172.15.010101011|0000000 (Network)


172.15.010101011|111111 (Broadcast)

And that is how we subnet!

Sponsored Links
#2296 - 04/04/03 05:45 AM Re: An Introduction to Subnetting  
Joined: Feb 2002
Posts: 7,202
Gremelin Offline
Community Owner
Gremelin  Offline

Community Owner

Joined: Feb 2002
Posts: 7,202
Likes: 11
Portland, OR; USA
You forgot class d! the direct ip's! lol...

Donate to UGN Security here.
UGN Security, Back of the Web, and VNC Web Services Owner
#2297 - 04/04/03 11:44 PM Re: An Introduction to Subnetting  
Joined: Mar 2002
Posts: 1,041
Infinite Offline
UGN Elite Poster
Infinite  Offline
UGN Elite Poster

Joined: Mar 2002
Posts: 1,041
Canada eh
yeh, I left out the class e (reserved/experimental) as well. If you can tell me what exactly these have to do with subnetting I might even care too =


Member Spotlight
Portland, OR; USA
Posts: 7,202
Joined: February 2002
Show All Member Profiles 
Forum Statistics
Average Daily Posts0
Most Online1,567
Apr 25th, 2010
Latest Postings
by Cyrez on 12/16/17 09:19 AM
Okay WTF?
by HenryMiring on 09/27/17 08:45 AM
The History Thread...
by Gremelin on 08/11/17 07:11 PM
my old account still exists!
by Gremelin on 08/11/17 07:02 PM
My friend NEEDS your HELP!
by Lena01 on 07/21/17 07:06 AM
I'm having fun with this guy.
by gabithompson730 on 07/20/17 08:50 AM
I want to upgrade my phone
by gabithompson730 on 07/20/17 08:49 AM
Top Posters(All Time)
UGN Security 41,392
Gremelin 7,202
§intå× 3,255
SilentRage 1,273
Ice 1,146
pergesu 1,136
Infinite 1,041
jonconley 955
Girlie 908
unreal 860
Top Liked Users (All Time)
§intå× Likes: 3
Black Beard Likes: 1
Cold Sunn Likes: 1
Crime Likes: 1
Cyrez Likes: 1
fleshwound Likes: 1
Ghost Likes: 2
Gremelin Likes: 12
Ice Likes: 1
ninjaneo Likes: 1
Powered by UBB.threads™ PHP Forum Software 7.6.0
(Snapshot build 20170206)