Help With Subnetting

Stuff that don´t fit in the other categories.
Post Reply
User avatar
lilrofl
Siliconoclast
Siliconoclast
Posts: 1363
Joined: 28 Jan 2009, 17:00
15
Location: California, USA
Contact:

Help With Subnetting

Post by lilrofl »

I've been trying for a few weeks now to get a grasp on sub-netting, every time I think I'm getting close I still come up with the wrong answers. This is for school and is testable, so solutions like use a subnet calculator are less then useful ;)

Any help in demystifying it would be appreciated.

I am pretty good on classful subnets, but a little clarification wouldn't hurt, however when you get into CIDR notation I am totally lost.

How do you take an IP address ie. 128.123.0.0/30 and figure out the subnet mask, the number of subnets and the number of host per subnet?

In this example, I know that 128.x.x.x is a Class B address, so there is 16 bits for the network address and 16 bits for the host address. But how many host bits are borrowed, how do figure that, and what process do you go through to figure out the subnet mask, the starting network address, the range, and the broadcast address.... and is the next subnet simply the next number after the last subnets broadcast address?

I know if I just keep staring at it, and redoing the tables and playing with the calculator it will eventually make some sense, but if someone here understands and can explain it easily, you would save me literally hours of of trying to reinvent the wheel.
knuffeltjes voor mijn knuffel
[img]http://i911.photobucket.com/albums/ac320/stuphsack/Sig.jpg[/img]

User avatar
bad_brain
Site Owner
Site Owner
Posts: 11636
Joined: 06 Apr 2005, 16:00
19
Location: In your eye floaters.
Contact:

Re: Help With Subnetting

Post by bad_brain »

ok, where to start...
an IP address is 32 bits: 11111111.11111111.11111111.11111111
192.0.1.128/27 means 27 bits are set: 11111111.11111111.11111111.11100000
so in /27 5 bits are remaining, and the possible amount of combinations of 5 bits (like 10001, 10011, 10111, etc.) is the number of IPs, so 5 bits (or /27) equals 32 IPs.
but there is a difference between hosts and the IPs, and that difference is (always): 2
so /27 contains 32 IPs but only 30 hosts that can be used, because:
11111111.11111111.11111111.11111111 (all of the 5 bits set) is reserved for broadcasting
11111111.11111111.11111111.11100000 (all 5 bits unset) is reserved for the net descriptor

it's actually pretty easy to calculate the amount of IPs:
up to /24 (old "class C") = 256
downwards simply divide by 2 with every step, /25 =128, /26 =64, etc., upwards multiply in x2 steps:
/23 = 2x256
/22 = 4x256
/21 = 8x256
/20 = 16x256
etc.
until the next old class block is reached /16 (old "class B"), this would be:
/16 = 256x256, but to make it easier use 65.536
/15 = 2x65.536
/14 = 4x65.536
/13 = 8x65.536
etc.
up to /8 (old "class A")
/8 = 256x65.536, to make it easier use 16.777.216
/7 = 2x16.777.216
/6 = 4x16.777.216
etc.

once you understood the steps (ok, I have to admit I also simply had to learn them before I understood it after a while ^^) all you actually have to keep in mind is "8 bit = 256", from that point you can calculate the amount of IPs easily then.
:wink:
Image

User avatar
DNR
Digital Mercenary
Digital Mercenary
Posts: 6114
Joined: 24 Feb 2006, 17:00
18
Location: Michigan USA
Contact:

Re: Help With Subnetting

Post by DNR »

ah yes - sounds like someone is taking "introduction to dynamic networks" perhaps aka Novell cert? =D>
Subnetting is a serious, forgotten security setup

Now, besides what BB said 196.86.1283/27- (Cider fool!) perhaps you also meant creating subnet masks
ie 255.255.254.0?

First, always remember the decimal values 128 64 32 16 8 4 2 1

If you slept through the instructor's lecture - see it here in pdf
http://www2.cegep-rdl.qc.ca/prive/pr-ci ... pter_6.pdf" onclick="window.open(this.href);return false;

You can traverse the above directory - change the chapter number..but thats the chapter for subnetting.

A chart to print out.
https://nsrc.org/workshops/2009/summer/ ... etting.pdf" onclick="window.open(this.href);return false;

real answer is here:
my bitches at akadia sends:
http://www.akadia.com/services/ip_routi ... bnets.html" onclick="window.open(this.href);return false;

Go study - you'll just forget it after the exam and just use a chart or calculator :-99

DNR
-
He gives wisdom to the wise and knowledge to the discerning. He reveals deep and hidden things; he knows what lies in Darkness, and Light dwells with him.

User avatar
lilrofl
Siliconoclast
Siliconoclast
Posts: 1363
Joined: 28 Jan 2009, 17:00
15
Location: California, USA
Contact:

Re: Help With Subnetting

Post by lilrofl »

Thanks, I will try to apply this to the homework this evening,

I am in a foundational CNS program working for a Information System Security degree. It's so far been pretty easy, but sub-netting is kicking my butt, and it's 33% of the final so I can't just dismiss it as insubstantial.

Again thanks, I'll come back if I run into another road block
knuffeltjes voor mijn knuffel
[img]http://i911.photobucket.com/albums/ac320/stuphsack/Sig.jpg[/img]

User avatar
l0ngb1t
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 598
Joined: 15 Apr 2009, 16:00
15
Contact:

Re: Help With Subnetting

Post by l0ngb1t »

damn wish i was here earlier ](*,) i like it when it comes to networking.
gonna say some stuff anyway :P

assume that you have the IP 192.168.1.0/24 (class C with default subnet 255.255.255.0)
with host number calculation u may have to answer it's 256 or 254... both are acceptable.
'cause i noticed in some references they substract the network address and the broadcast address, to be more clear with such set of IP and subnet you have 256 address and 254 host valid IP address.
+ there is another rogue debate about the network number as well, especially between cisco and microsoft dudes (i stand for the cisco dudes in this one :P), consider that it is the 2^additional bit - 2 'cause the exclude the first and the last network, 'cause it the first network the identical for any subnetmask taken
and the last subnetwork have the same address as the subnet (it'll be demonstrated as we go).

now you have to put in mind that the subnet will divide the IP into 2 portions:
Network portion (obtained by a logic and between the IP and the subnet) it defines the network that you are in.
and the Host portion, it's the rest of the bits.
to get the network address all what you have to do is convert both IP and subnet mask into binary and do a logic and, the result will be the network IP address. for that we'll use a host address 192.168.1.192 with the class C default mask 255.255.255.0 or /24
note that in real life practice u'll use most of the time the 4 bytes subnet mask rather then the slash annotation
1 and 1 = 1 and the rest = 0
192.168.1.192 -> 11000000.10101000.00000001.11000000
255.255.255.0 -> 11111111.11111111.11111111.00000000
result -> 11000000.10101000.00000001.00000000 = 192.168.1.0

now you have 192.168.1.0/26
the total byte number of an ip is 32 so 32-26=6
it means we have 6 bits in the host portion
and the /26 means that the first 26 bits are the network portion, those bits define the address of the network that you are in.
now they main idea behind subneting is to divide 1 network address into multiple subnetworks.
so in this case with the default subnet (255.255.255.0) we have only one network.
with /26 we add 2 additional bits to the original network address portion that is by default /24.
lets do it in binary to get it more clear:
192.168.1.0 -> 11000000.10101000.00000001.00000000
as you notice the bits in red are the network address portion, and it is clear that 2 bits from the 4th octet are added to the network portion because of the subnet we choosed (/26).

now how to make use of this!
simply 2 bits gives you 2^4 combinations: 00, 01, 10, 11.
so the network address's that we get are:
11000000.10101000.00000001.00000000 -> 192.168.1.0
11000000.10101000.00000001.01000000 -> 192.168.1.64
11000000.10101000.00000001.10000000 -> 192.168.1.128
11000000.10101000.00000001.11000000 -> 192.168.1.192

now since we have /26 as subnet it leaves us with 6 bits for host portion it means 2^6 = 64 unique number or possible IP address. (network address can be calculated by adding 64 )
so the range of the first network ip's including the 0 is 192.168.1.0 till 192.168.1.63 and so on for the 192.168.1.64 network etc...

now the boradcast address of each subnetwork is obtained by filling the host portion by 1's
let's do it for the 192.168.1.0/26
11000000.10101000.00000001.00111111 - > 192.168.1.63
11000000.10101000.00000001.01111111 - > 192.168.1.127
11000000.10101000.00000001.10111111 - > 192.168.1.191
11000000.10101000.00000001.11111111 - > 192.168.1.255

now the first usable HOST address is the network address + 1
the last usable HOST address is the broadcast address - 1

the number of address's per subnetwork = 2 ^ HOST_PORTION_BITS
and 2 ^ HOST_PORTION_BITS - 2 if you want to exclude the network address and the broadcast address.
Remember: a network address is always a even number and the (DNR edit)- SUBnetwork address is always a odd number if you got results that doesn't apply to this it means you have something wrong.

now let's sum up all the result into 1 table

network address subnet mask broadcast address number of address HOST range
192.168.1.0 --- 192.168.1.192 ---- 192.168.1.63 ---- 64 ------ 192.168.1.1 -> .62
192.168.1.64 --- 192.168.1.192 ---- 192.168.1.127 ---- 64 ------ 192.168.1.65 -> .126
192.168.1.128 --- 192.168.1.192 ---- 192.168.1.191 ---- 64 ------ 192.168.1.129 -> .190
192.168.1.192 --- 192.168.1.192 ---- 192.168.1.255 ---- 64 ------ 192.168.1.193 -> .254
in this table you notice that in the last line the network address and the subnet are the same as i mentioned at the beginning
and about the identical address for different subnet mask
say you have 192.168.1.0/24 and another /25 and a /26
for all of them the first network will be 192.168.1.0
but it won't cause any problem IMO


VLSM (variable length subnet mask) it is simple subnet but the length of the subnet mask differs.
with CIDR you simply discard everything you learned about IP class's and default subnet mask.
There is an UNEQUAL amount of good and bad in most things, the trick is to work out the ratio and act accordingly. "The Jester"

User avatar
lilrofl
Siliconoclast
Siliconoclast
Posts: 1363
Joined: 28 Jan 2009, 17:00
15
Location: California, USA
Contact:

Re: Help With Subnetting

Post by lilrofl »

ok, again I appreciate all the help I got here, and I've worked out a simple method for sub-netting. I'm working up a tutorial explaining and should have it up in a few days as I just passed my test and think it will help solidify the data.
knuffeltjes voor mijn knuffel
[img]http://i911.photobucket.com/albums/ac320/stuphsack/Sig.jpg[/img]

User avatar
DNR
Digital Mercenary
Digital Mercenary
Posts: 6114
Joined: 24 Feb 2006, 17:00
18
Location: Michigan USA
Contact:

Re: Help With Subnetting

Post by DNR »

and then throw it all away. Use the space in your head for more popular networking and security stuff. I busted my ass to pass the exam, and then never had to use it again.
May you be lucky, or cursed with cider shit.

Congrats on the exam, it means you can wrap your head around some tougher technical stuff. *thumb*

DNR
-
He gives wisdom to the wise and knowledge to the discerning. He reveals deep and hidden things; he knows what lies in Darkness, and Light dwells with him.

User avatar
lilrofl
Siliconoclast
Siliconoclast
Posts: 1363
Joined: 28 Jan 2009, 17:00
15
Location: California, USA
Contact:

Re: Help With Subnetting

Post by lilrofl »

DNR wrote:Congrats on the exam, it means you can wrap your head around some tougher technical stuff. *thumb*

DNR
You know I will :D
knuffeltjes voor mijn knuffel
[img]http://i911.photobucket.com/albums/ac320/stuphsack/Sig.jpg[/img]

Post Reply