SLUG Mailing List Archives
[SLUG] IP Addressing/Subnetting The Easy Way...
- To: Howard Lowndes <lannet@xxxxxxxxxxxxx>
- Subject: [SLUG] IP Addressing/Subnetting The Easy Way...
- From: James Wilson <jamewils@xxxxxxxxx>
- Date: Mon Jul 17 10:16:09 2000
- Cc: Terry Collins <terryc@xxxxxxxxxx>, David Ryan <dsryan@xxxxxxxxxxxx>, slug@xxxxxxxxxxx
Here's a subnetting tip I have noticed since I work with routers
day in day out: Dont think in terms of the decimal notation of the masks,
think in terms of the binary -- it all becomes clear then, providing you
can see beyond the 000's and 111's :)... here what I mean :
In binary form an IP address looks like this (when sticking to the dot
octet notation), 4 blocks of 8 bits.
When your telco/ISP gives you a Class C they are allocating you 8 bits
worth of address space for you to use how you will. hence you get a
network address like this:
With a netmask of
Note how the netmask has the last 8 bits set to 0 and the first 24 bits
set to 1. This signifies that the first 24 bits are used to specify your
network (the block of addressing you own) and the last 8 bits are for
Now, with that understood you can understand subnetting. Subnetting is the
practice of taking the hostspace (those 8 bits) that your telco/isp has
given you and dividing them up further into smaller host networks. So, say
for example you wanted to divide your space in half. Essentially what you
are then doing is using an extra bit to specify your network space and 1
less bit to specify your host space (the extra bit is what devides the
networks, e.g if that network bit is 0 its subnet0 and if its 1 its
So, we have network addressing like this :
With a netmask of
Note the added '1' to the last octet of the network address space.
Now say you wanted to divide subnet1 in half, so that you have the big
subnet0 and two half sized subnets. You do the same, you make one of your
host bits a network bit. Hence the following network addressing.
With a netmask of
So now we should see a pattern forming. Each time you want to divide a
block of host addressing into half you simply take the first bit (the
furthest left) of the host space and make it a network bit, and then make
the corresponding bit in the netmask a '1' (it should have been a 0
before. if not, you werent looking at the host space).
So now that your comfortable with the binary of it (and wasnt it
simple!) lets relate it back to the decimal. The deicmal/binary
relationship is like this, just looking at one octet here (a group of 8
128 64 32 16 8 4 2 1
0 0 0 0 0 0 0 0
Hence the binary number 10010101 is really 128+16+4+1 = 149
So, now lets look at each of the combinations of netmasks you can have and
their decimal equivalents. (Im only going to look at Class C here, but it
extends right up the scale).
WHile this is very interesting, all you wanted to do was to work out how
many of the damn addresses you can fit in each subnet, or vice versa, what
size subnet you needed for a given amount of addresses. Well, it's dead
simple. Look at the last octet in the example above. Remebering that they
represent the NETWORK space, so hence it makes complete since that 'whats
left' is the host space.
Here is an example, it works the same for _every_ netmask.
So, you have a netmask of
Therefore you have a host space of
And its that simple, in a subnet with a mask of 255.255.255.240, you have
15 available addresses. BUT. Remever, with IP addressing the lowest
address (all 0's in the host space) is the network address (identifies the
subnet) and the highest address (all 1's in the host space) is the
broadcast address. So you only really have 13 addresses that you can use
for your actual hosts in the subnet.
So there you go, it's not really an art, it is a science... but damn it
helps to forget about decimal when your dealing with something that is
very binary centric in its addressing.
Gimme a yell if you have questions..
[=====================================================[ www.cisco.com ]====]
Hardware/VISE Customer Service Engineer
On Site Services - APT || ||
Phone : +61-2-8448-7919 |||| ||||
Pager : +61-2-9430-6381 ..:||||||:..:||||||:..
[============================[ USA 800-829-2447 ]=[ Aust 1800-121-531 ]====]