UGN Security Forums
My ProfileMember DirectoryLogin
Search our ForumsView our FAQView our Site Rules
View our CalendarView our Active TopicsGo to our Main Page

UGN Security Store

Network Sites UGN Security, The GoNix Initiative, Elite Web Gamers, Back of the Web, EveryDay Helper, VNC Web Design & Development
Sponsored Links
Latest Postings
by Gremelin
10/05/15 06:01 PM
Latest Reviews
Topic Options
Rate This Topic
#2295 - 04/01/03 05:18 PM An Introduction to Subnetting
Infinite Offline

Registered: 03/09/02
Posts: 1041
Loc: 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/03/03 09:45 PM Re: An Introduction to Subnetting
Gremelin Offline

Community Owner

Registered: 02/28/02
Posts: 7194
Loc: Portland, OR; USA
You forgot class d! the direct ip's! lol...
Donate to UGN Security here.
UGN Security, Back of the Web, Elite Web Gamers & VNC Web Design Owner

#2297 - 04/04/03 03:44 PM Re: An Introduction to Subnetting
Infinite Offline

Registered: 03/09/02
Posts: 1041
Loc: 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 =



Moderator:  Infinite 
Featured Member
Registered: 02/28/02
Posts: 7194
Forum Stats
2158 Members
46 Forums
41613 Topics
76788 Posts

Max Online: 1567 @ 04/25/10 02:20 AM
Top Posters
UGN Security 34775
Gremelin 7194
§intå× 3255
SilentRage 1273
Ice 1146
pergesu 1136
Infinite 1041
jonconley 955
Girlie 908
unreal 860
Newest Members
Jan Havelles, Herbert_Sherbert, codemauve, Lillysdragon1984, Brewwit
2158 Registered Users
Who's Online
0 registered (), 225 Guests and 341 Spiders online.
Key: Admin, Global Mod, Mod
Latest News

  Get Firefox!
Get FireFox!