Baraka Network Baraka Network
Translate this page in :
French
German Italian Portuguese Arabic Japanese Korean Spanish
Mastering Networks made easy
Products

 

"I needed help urgently with my office network.
I called up Baraka and they solved the issue in no time at all. "
            -Mike Kendrick.


Easy Solutions at Baraka

 

ontact Details:
Head office
6-353 Broadway
Shawinigan Que.
Canada G9N-1M2
(819) 531-2340

 

Subnet Howto

Here's a complete list of all the subnet sizes you can have in IPv4, from smallest to largest:
You'll also need an IP for the default router (if it's just a stub network), so the number of IP's usable for hosts is total - 3.

Number
of IP's
per Net
Netmask /bits Notes
1 255.255.255.255 /32 A 'host' route
2 255.255.255.254 /31 Not usable.
4 255.255.255.252 /30 Smallest usable subnet
8 255.255.255.248 /29
16 255.255.255.240 /28  
32 255.255.255.224 /27 This is a good size of network to use allowing you to have 29 clients.
64 255.255.255.192 /26 This is also good with 61 clients.
128 255.255.255.128 /25  
256 255.255.255.0 /24 Traditional class C
512 255.255.254.0 /23  
1024 255.255.252.0 /22 (current) RIPE default initial allocation size
2048 255.255.248.0 /21
4096 255.255.240.0 /20  
8192 255.255.224.0 /19 Old RIPE default initial allocation size
16384 255.255.192.0 /18
32768 255.255.128.0 /17  
65536 255.255.0.0 /16 Traditional Class B
131072 255.254.0.0 /15
262144 255.252.0.0 /14
524288 255.248.0.0 /13
1048576 255.240.0.0 /12
2097152 255.224.0.0 /11
4194304 255.192.0.0 /10
8388608 255.128.0.0 /9  
16777216 255.0.0.0 /8 Traditional Class A
33554432 254.0.0.0 /7
67108864 252.0.0.0 /6
134217728 248.0.0.0 /5
268435456 240.0.0.0 /4
536870912 224.0.0.0 /3  
1073741824 192.0.0.0 /2 A quarter of the net.
2147483648 128.0.0.0 /1 Half the 'net
4294967296 0.0.0.0 /0 All the hosts on the net, the 'Default route'.

To simplify things in the following examples it's only going to use last 8 bits of the network address and netmask rather than the full 32.

N.B. you don't have to read this bit if maths scares you, use the table above.

But first I'd better tell you how to convert from binary to decimal and back.

This is actually pretty simple once you get the hang if it. The first thing to do is to cast your mind back to when you where learning basic arithmetic and where learning about the 'ones, tens, hundreds, and thousands column'

In base 10 (decimal) each column goes up in powers of 10:

1000000 100000 10000 1000 100 10 1

In base 2 (binary) each column goes up in powers of 2:

128 64 32 16 8 4 2 1

Converting from base 2:

Lets say we've got 00110011 and we want to convert it to decimal

Write down all the 8 powers of two from 128 to one from right to left, and write the bits underneath:

128 64 32 16 8 4 2 1
0 0 1 1 0 0 1 1

Now, take all the numbers in the top row that are over a 1, and add them together:

32 + 16 + 2 + 1 = 51

So 00110011 in decimal is 51

Converting back again is pretty easy too, just take the number and divide it by the highest power of two and record the answer. Then take the remainder and divide it by the next highest and so on, either until the remainder is zero or you get to 1:

51 / 128 = 0 remainder 51
51 / 64 = 0 remainder 51
51 / 32 = 1 remainder 19
19 / 16 = 1 remainder 3
3 / 8 = 0 remainder 3
3 / 4 = 0 remainder 3
3 / 2 = 1 remainder 1
1 / 1 = 1 remainder 0

If you look down the results column (after the equals) you get 00110011, Which is what we started with...

Now, your probably wondering how this is relevant to networking and how the network address and netmask interact, and how you use the host and network portions of the netmask.

Well it's

The next thing you need to know is an operation called a binary AND, it's also pretty simple
 

network address bit netmask bit result
1 1 1
0 1 0
1 0 0
0 0 0

Because the netmask must always be a continues line of '1' bits from right to left, each subsequent 1 bit produces two networks that are half the size of the previous one and fit exactly inside it.

This is hard to visualize

Netmask length Last 8 bits   Adding up powers of two Final Netmask
/24 0000 0000 0 255.255.255.0
/25 1000 0000 128 255.255.255.128
/26 1100 0000 128+64 255.255.255.192
/27 1110 0000 128+64+32 255.255.255.224
/28 1111 1000 128+64+32+16 255.255.255.240
/29 1111 1100 128+64+32+16+8 255.255.255.248
/30 1111 1100 128+64+32+16+8+4 255.255.255.252
/31 1111 1110 128+64+32+16+8+4+2 255.255.255.254
/32 1111 1111 128+64+32+16+8+4+2+1 255.255.255.255
  • Firstly the number of IP addresses in a subnet will always be a power of 2 (2, 4, 8, 16, 32, 64, 128, etc...)

  • And secondly the boundaries that subnets can occur on are fixed.

The second point could probably do with some explanation. probably the best way is to show you this table which shows you all the ways you can split a /24 (a Class C). 
 

Netmask Mask Length Num. of 
networks in a /24
Number of IP's
255.255.255.0 /24 1 256
255.255.255.128 /25 2 128 128
255.255.255.192 /26 4 64 64 64 64
255.255.255.224 /27 8 32 32 32 32 32 32 32 32
255.255.255.240 /28 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16
255.255.255.248 /29 32 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8

You can see that if you used the first 64 IP's for one subnet (a /26), and the last for a second, you couldn't then use the middle 128 IP's for one subnet, you'd have to make 2 more 64 IP subnets or move both /26's to the beginning of the range or at the end.

e.g.

Key
Can't use
In use
wrong:
/25 128 128
/26 64 64 64 64
 

Right:

/25 128 128
/26 64 64 64 64

 

Here are some easy things to check to make sure that you've got the subnet split properly:

  • The network address will always be an even number.

  • The default router/gateway, which by convention is the network address + 1 will always be an odd number.

  • The broadcast address is always an odd number.

  • The highest usable IP address (broadcast address - 1) will always be an even number.

Note that in any IP network (apart from unnumbered point to point links) you lose 2 IP's - one for the network address (the smallest one), and one for the broadcast address (the highest one). You can use the network address for a host under some circumstances, but it's best to leave it alone.

If you want to find out more about this then type 'CIDR' into your favorite search engine, there is plenty of info out there.

Home :: :: Products :: :: How to :: :: FAQs :: :: Download :: :: Contact Us