IP range with prefix - less than /24?

/18 is the cidr notation which means an 18 bit subnet mask...a subnet mask is a 32 bit binary number, broken down into 4 'octets'...as the number is 'binary' it can only consist of 0's and 1's. an octet could be 11001011...which if you then conver to decimal it becomes 203...i did this by using the standard conversion table of 128/64/32/16/8/4/2/1...so against that octet we have (add up all the '1' positions) 128+64+8+2+1=203. so, since we know that a subnet mask consists of 4 octets, and we know that the cidr notation that your working with is /18, we know that 8 + 8 = 16...which means in the 3rd octet you are using 2 bits...since the 3rd octet (just like the rest) consists of 128/64/32/16/8/4/2/1 we know that the second bit is 64...which is why /18 means the networks go up in 64's...oh, and since the first two octets are all 1's this is why they are 255, and in the 3rd octet we add 128+64=192...which is where 255.255.192.0 comes from...
 
Last edited:
one way to work it out is by changing the decimal numbers into binary, and its easy to see which parts are the network address and which is host address. Ill use your example of 136.185.86.112/18 to try and explain what i mean.


/18
11111111.11111111.11000000.00000000 = 255.255.192.0 subnet mask
The 1's represent what will be the network address, and the 0's represent the nubmers used for host address

136.185.86.112
10001000.10111001.01010110.01110000

10001000.10111001.01 <-- first 18 bits

if you set all remaining bits to 0 it will give you the network start address
10001000.10111001.01000000.00000000 = 136.185.64.0 <-network address

set all remaining bits to 1 and that will be the final address (broadcast)
10001000.10111001.01111111.11111111 = 136.185.127.255


If you need to work out the maximum number of hosts on the subnet, then look at how many host bits there are. A subnet of /18 leaves 14 host bits, 111111 11111111 = 16320, but because the first address is the network address and the last is broadcast, that leaves 16318 usable host addresses on that subnet.
 
Last edited:
yeah my bad, i hate messing arround with windows calc to change binary into denary. I prefer my trust TI-83+ but thats not to hand at the moment.

The rest of my post should be accurate i hope though, and its the way i learned about subnetting so i hope its usefull to the OP.
 
yeah I don't do ip subnets that often which is why I found the IP calculator really handy.

I posted the link further up. It shows the binary workings etc so its easy just to punch in some examples and then it generally clicks in your head and you're away
 
hi atomiser

i apologise for not getting back to you, i was fitted in the new bath and shower tray last night and should be be finished by tonight.

then will look at it again tomorrow when i'm at work.

that whiteboard site is not working for me :(
 
lol no worries, hope the bathroom is going ok...i've often thought it would make more sense being a plumber or a sparky than working in it!!!

give this site a whirl: http://www.learntosubnet.com/

you really need to get to grips with powers of 2 and the whole binary thing...once you've got that down the subnetting will fall into place...

give me a shout if you need owt else!
 
It's just a case of learning binary.
You've got 4 octets (sets of 8 bits) in an IP address, for 32 total. The /** tells you how many of the bits of the mask are used for the subnet mask (set to 1)

say it's /19

the mask is

|11111111|11111111|11100000|0000000|
which in binary translates to
|255|255|224|0

to work it out quickly, just take 8 away from the /** number until you are left with a remainder, and then add up the bits. Each bit represents a power of 2.
In this case it's 3 so:
|.1....1...1..0..0 0 0 0|
|128 64 32 16 8 4 2 1|

add 128+64+32 (those are the bits that are "on") and you have the value for that octet, in this case 224.
 
Last edited:
Back
Top Bottom