Tech Support > Computers & Technology > Internet & Broadband > IP range notation
IP range notation
Posted by Colin Wilson on January 13th, 2005



Has anyone got any idiot-proof links that describe notation you may come
across for IP ranges ? ie. 201.255.0/17

Thanks :-)

--
Please add "[newsgroup]" in the subject of any personal replies via email
--- My new email address has "ngspamtrap" & @btinternet.com in it ;-) ---

Posted by Stuart Millington on January 13th, 2005


On Thu, 13 Jan 2005 23:06:15 -0000, Colin Wilson <void@btinternet.com>
wrote:

A quick google on "IP class CIDR notation" turns up (amongst many):

http://www.tcpipguide.com/free/t_IPS...IDRHie ra.htm

http://compnetworking.about.com/od/w.../aa021003a.htm


--
------------------------------------------------------------------
- Stuart Millington ALL HTML e-mail rejected -
- mailtohupp@dsv1.co.uk http://w3.z-add.co.uk/ -
begin OE is broken read MS knowledgebase Q265230

Posted by Colin Wilson on January 13th, 2005


Thanks - i`d already tried "ip range allocation" & "ip block allocation"

I hadn`t heard of CIDR before...

--
Please add "[newsgroup]" in the subject of any personal replies via email
--- My new email address has "ngspamtrap" & @btinternet.com in it ;-) ---

Posted by Colin Wilson on January 13th, 2005


I wonder... in the example I give above then, is the effective IP range
201.255.0.0 -> 201.255.255.128 or thereabouts ?

Thanks :-}

--
Please add "[newsgroup]" in the subject of any personal replies via email
--- My new email address has "ngspamtrap" & @btinternet.com in it ;-) ---

Posted by Dave Reader on January 14th, 2005


Colin Wilson <void@btinternet.com> wrote:

This will make the most sense if you also read a little about how IP
Routing works, but a quick run through address notation could be like
this..


An IPv4 address is a 32 bit binary number. It's broken into 4 bytes, most
significant first, for writing in "dotted decimal" format, such as
212.23.10.115

Where you want to describe a range of addresses which begin and end on
"bit boundaries" (and as such they are actually routable as a single
entity), you only need to specify how many of the bits represent the
network (the remainder being used to address devices on the network).

That can be done easily with a network mask or a prefix length..

A network mask is also written in dotted decimal, for eg 255.255.255.0

The Network Address is the bitwise AND of the Address and the Network
Mask, so..

...for an address 212.23.10.115 with network mask 255.255.255.248, we
have..

212 AND 255 .. which is .. 11010100 & 11111111 .. which = 212
23 AND 255 .. which is .. 00010111 & 11111111 .. which = 23
10 AND 255 .. which is .. 00001010 & 11111111 .. which = 10
115 AND 248 .. which is .. 01110011 & 11111000 .. which = 112

...so that's on network 212.23.10.112

These can be written as..

212.23.10.115/255.255.255.248 describing the host and network
212.23.10.112/255.255.255.248 describing the network only

You can also see that there are 29 1's in the mask before the 0's. That's
the prefix length, so that can be written as..

212.23.10.115/29 describing the host and network
212.23.10.112/29 describing the network only

Both of these notations represent the addresses 212.23.10.112 through to
212.23.10.119 inclusive, although the first example in each case is
specifically representing the address 212.23.10.115.

To determine how many addresses are in a given range, simply consider the
number of 0's at the end of the (binary) network mask..

In the above example, 3 zeros, so 8 possible addresses can be
represented.

If the network mask is written in dotted decimal, there's a quick trick
for the simple cases .. For the above example, 256 - 248 is 8.

Also note that 32 (bits in an IPv4 address) - 29 (prefix length) = 3
...and that 2^3 (2 to the power of 3) is 8.

If you want to represent a range of IP addresses which is not a power of
2, then you should simply show the beginning and end, eg, the 5 addresses
in the range "212.23.10.113 - 212.23.10.117".

Sometimes people will talk about Classes of addresses. Before routing on
the Internet supported arbitrary prefix lengths (ie, anything from /0 to
/32) as it does today, the 32 bit IPv4 address space was sliced up into 6
classes of address, called Classes A, B, C, D, E, and F.

One popular misconception is that "Class C" means "/24" (in prefix length
notation). That's actually incorrect - Class C networks are /24 networks,
but not all /24 networks are Class C.

In the old Classful system, it's the most significant few bits of an
address which tell you what class the address is.

You shouldn't need to know about classful addressing now, unless you're
working with very old software/devices, multicasting, or have some reason
to work with experimental addresses - but do be aware that the terminology
is still often used, misused, and abused.

d.

Posted by Dave Reader on January 14th, 2005


Colin Wilson <void@btinternet.com> wrote:
it's 201.255.0.0 - 201.255.127.255


In the example you gave "201.255.0", so the 4th octect is assumed to be
zero (ie, 201.255.0.0).

The prefix length is 17, so the network mask is 255.255.128.0

The opposite of the network mask (sometimes called the wildcard, or host,
bits) is 0.0.127.255.

The sum of the network and the "all-ones" host bits is the final address
in the range.

Hence the range is 201.255.0.0 (the network address, with all host bits
set to zero) to 201.255.127.255 (the network address, with all host bits
set to one).

d.




Posted by Alex Heney on January 14th, 2005


On Thu, 13 Jan 2005 23:58:20 -0000, Colin Wilson <void@btinternet.com>
wrote:

There are a total of 32 bits in an IP address, broken down into 4
groups of 8., then represented as a decimal for each of those groups.

The 17 means the first 17 of those bits must be the same. Which is all
of the first two groups, and the first bit of the third group. so the
third group can be anything from 00000000 to 01111111 in binary (0 to
127 in decimal)

So your range is 201.255.0.0 -> 201.255.127.255 (you had the last two
octets the wrong way around, and forgot that the zero is one of the
128 possibilities).

--
Alex Heney, Global Villager
If I had anything witty to say, I wouldn't put it here.

To reply by email, my address is alexATheneyDOTplusDOTcom

Posted by Colin Wilson on January 14th, 2005


I think I follow you - I just got the order wrong, and dropped a bollock
somewhere on the maths - most significant byte in the wrong order or
something :-}

I think i`ll have to wait until my head stops spinning before I try to
figure out how the network mask works, but I think I see what you`ve done
for the wildcard (255-networkmaskoctet)

--
Please add "[newsgroup]" in the subject of any personal replies via email
--- My new email address has "ngspamtrap" & @btinternet.com in it ;-) ---

Posted by Colin Wilson on January 14th, 2005


Thanks for that - I think its starting to gel a little now :-}

--
Please add "[newsgroup]" in the subject of any personal replies via email
--- My new email address has "ngspamtrap" & @btinternet.com in it ;-) ---

Posted by Gizmo on January 14th, 2005



"Colin Wilson" <void@btinternet.com> wrote in message
news:MPG.1c512af66325651298acdb@news.individual.ne t...
Are you saying you're ready for the exam now ? ;o)



Posted by Colin Wilson on January 14th, 2005


Shoot ! - oh, hang on, if there`s an exam, shoot ME ! :-}

--
Please add "[newsgroup]" in the subject of any personal replies via email
--- My new email address has "ngspamtrap" & @btinternet.com in it ;-) ---

Posted by Martin on January 21st, 2005


Colin Wilson wrote:
palm/handhold/portable/whatever Either that or get quick with binary!

why on earth doesn't everyone use hex - which I can do masks with in my
head? *wibble*

Posted by Dave J on January 21st, 2005


In MsgID<cspl9c$2u8$4@hercules.btinternet.com> within
uk.telecom.broadband, 'Martin' wrote:


I think it's grasping the concept that people find difficult, once you've
understood that there are 2^32 possible IPs for n1.n2.n3.n4, because it's
a binary 32 bit number (4 8 bit numbers dotted, 2^32 = 256*256*256*256)
the rest is easy.

It's obvious enough that if you had to administer the entire IP range, you
couldn't possibly deal with 8,589,934,592 (2^32) addresses in one lump, so
a method is needed to divide them into 'area codes' and 'phone numbers',
and because different people need to administer different size areas there
are varying combinations of how many bits should be the 'area' (network)
bits and how many should be the 'host' bits.

All a network mask is is a description of which bits represent the area
code 'owned' by the network, and which bits represent the individual
machine. Obviously enough, when routing packets to a host, initially it is
done on network address (eg 62.*.*.* for BT's network) because they just
need to be passed in the right direction, later as it gets closer to
destination, it is done on which actual host is required.

Masks stop being confusing if you spot that they always have to start with
a sequence of 1s, and end in a sequence of zeros, so if I 'owned' the
network 192.121.22.* my network mask would be 255.255.255.0 (all ones
until the final 8 bits)

You start having to do binary translation if you don't want your host bits
to be a multiple of 8, say I wanted 1024 hosts on a network, 1024 is 2 to
the power of 10, so I need 10 host bits and 22 bits in my network address,
so to represent the network bits as ones in a mask, I need a mask of
11111111111111111111110000000000.

Now, that is a ludicrously awkward way to write it, so I start by dotting
it into groups of 8 bits 11111111.11111111.11000000.00000000, and then I
convert it to decimal 255.255.192.0 - Job done.

Now, all my devices know which bits to look at from an IP address to tell
if a packet 'belongs' on my network or not.

Final points are that you also get networks within networks, if *I* owned
62.0.0.0 (255.0.0.0) then I would subdivide *that* so that I could
administrate it, maybe firstly into 256 subnetworks each with 65536
(65536=256*256) host addresses (255.255.0.0), and then on down into
smaller and smaller (sub)networks. Second thing is the notation of
a.b.c.d/nn, the nn represents the number of ones at the beginning of the
mask, so 62.1.2.0/24 would have a mask of 255.255.255.0 - equivalent to a
network of 62.1.2.*

I do it in decimal because that's the way I see it written. Hex is not a
problem, but because masks only have eight different decimal possibilities
it is easy enough for those numbers to 'stick' - then again I regard the
power of two table as a good educational ingredient..

Once you've grokked the importance of 2^n-1 and multiples of 8, you're in
business.

Before anyone points it out, I know I've neglected various issues WRT
network addressing, but they're just RL practicalities that are easily
picked up later. Also, there's some core things about numerical bases and
the binary system that I have assumed to be understood, but there *is* a
limit to the length of one posting

Dave J.

Posted by Colin Wilson on January 26th, 2005


OK, you`re going to hate me, but... taken from a spam mail, and this
result given by samspade :-}

200.93.135.208/28

The /28 would appear to be a sodding great number of bits to use - would
it relate to 2^(31-28)=8, so that only 8 IP addresses are addressable as
shown above, ie. 200.93.135.208 to 200.93.135.215 ?

(should that be 32 minus the /xx ? - its late, i`m tired :-} )

Its also shown on the same page as 200.93.128/19

ie. 2^(31-19)
--------- =4096
256

Would that be 200.93.128.0 to 200.93.144.255 in real terms ?

I was going to block the entire range in Mailwasher (hell, I don`t know
anyone in Colombia, and the From: is always spoofed), but i`m not sure
how to reconcile these two different ranges...

--
Please add "[newsgroup]" in the subject of any personal replies via email
--- My new email address has "ngspamtrap" & @btinternet.com in it ;-) ---

Posted by Steve Wyles on January 26th, 2005


Colin Wilson <void@btinternet.com> wrote:
Almost! It's 2^(32-28) which is 16 IP addresses.

Steve

Posted by Dave J on January 26th, 2005


In MsgID<MPG.1c6114653c5e6dc598adc1@news.individual.n et> within
uk.telecom.broadband, 'Colin Wilson' wrote:

the /28 is the number of bits that are the network part, so there are four
bits left to specify which host at that network.

Four bits is sixteen combinations, with all zeros usually being unused as
it's the network address, and all ones being unused as it's the network's
broadcast address, this leaves 14 useable host addresses.

Network address 200.93.135.208 (last four bits all zeros so lowest address
on a /28), broadcast address 200.93.135.223 (highest address), so there's
your range.

/28 as a mask is 255.255.255.240, (255 = 11111111, 240 = 11110000) if it's
at all relevant.

And, for the sake of interest, it becomes clearer if you write the .208
(the last eight bits of the address) as binary - .11010000 - notice how
the last four are zero, now if you make them all one, you get 11011111
which is 223, the network's broadcast addy and the *last* valid address on
that subnet.

If we apply the IP to my favorite web-interface whois service we get
http://www.dnsstuff.com/tools/whois....200.93.135.208

It's actually allocated to "Dreamers Online" and is a part of
200.93.128/19, a larger subnetwork, also allocated to the owner of
"Dreamers Online"

Have fun.

Dave J.
--
Dave Johnson - requiem@freeuk.com

Posted by Colin Wilson on January 26th, 2005


<snip>
Thanks for the clarification guys - I was tired and couldn`t remember
whether 31 or 32 bits was a starting point hence my 2^x was out by 1 (I
wasn`t sure if the first bit was reserved so dropped the number of bits
by 1 in error)

I think that means 200.93.128/19 gives 200.93.128.0 to 200.93.159.255
then... (2^13)/256=16 to add to the third octet (+15 & 0->255 really)

Not quite as easy to block manually unfortunately using a plain text
filter on the email headers :-}

--
Please add "[newsgroup]" in the subject of any personal replies via email
--- My new email address has "ngspamtrap" & @btinternet.com in it ;-) ---


Similar Posts