Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

So i am trying to understand subnetting. I understand that you can take 192.168.0.0/24 domain and break it up in 2 subnets. 192.168.0.0/25 and 192.168.0.128/25 .. so what if i need to create 2 more subnets inside both of those above subnets.

What if i need to create 2 subnets, which have 2 more subnets inside them and each of those 2 subnets have 2 hosts. As per my calculation, this would be something like.

top 2 subnets: 192.168.0.0/25 and 192.168.0.128/25

subnets of 192.168.0.0/25: 192.168.0.0/26 - 192.168.0.128/26

subnets of 192.168.0.128/25: 192.168.0.128/26 - 192.168.0.192/26

hosts of 192.168.0.0/25: 192.168.0.1/25 - 192.168.0.2/25

hosts of 192.168.0.128/25: 192.168.0.129/25 - 192.168.0.130/25

hosts of 192.168.0.0/26: 192.168.0.1/26 - 192.168.0.2/26

hosts of 192.168.0.128/26: 192.168.0.129/26 - 192.168.0.130/26

hosts of 192.168.0.128/26: 192.168.0.129/26 - 192.168.0.130/26

hosts of 192.168.0.192/26: 192.168.0.193/26 - 192.168.0.194/26

The above doesnt seem right, i am moving down like a tree, however the subnet mask and IPs are being repeated, i am just add 1 to /x and making the ips from there. Can anyone please tell me if this is correct

The scenario i am trying to understand is similar to this, however i just want to add hosts on each level as well. http://www.ciscotrick.com/wp-content/uploads/2008/08/the_mathematical_relationship_between_network_block_sizes.jpg

share|improve this question
3  
    
@Zoredache, that book you referred to might be more reading than SM was planing to do. ;) –  John Gardeniers Apr 19 '10 at 9:26
    
@John, you either understand this stuff, or you stuggle with it. Someone could easily take an evening and read through that and know all the basics. I agree with Zoredache, SM should read it. –  Chris S Apr 19 '10 at 13:23
    
@John Gardeniers: perhaps it to long, but it still doesn't hurt to provide a link to really good question that does good job covering most aspects of subnetting. –  Zoredache Apr 19 '10 at 16:06
    
It appears subtlety has been wasted. –  John Gardeniers Apr 19 '10 at 22:07
add comment

3 Answers

up vote 8 down vote accepted

Advice: learn hex and binary. It'll make more sense.

128 = 0x80, which in binary is 10000000. The 1 bit set means "this is part of the network" and the 0 bits mean "this is part of the host address." You would not have a subnet called 196.168.0.1/24 (but that could be a host address.) The netmask for that subnet would be 196.168.0.0/24. You may have 192.168.0.1/24 or /25 as a host address, but the network interface's netmask would be different, which is a fancy way of saying which hosts it thinks are local, and which have to go through the router.

a /25 has a netmask of 255.255.255.128, which is 0xffffff80. The high bit set in the last byte (0x80) is the important thing.

a /26 has a netmask of 255.255.255.192, which is 0xffffffc0. 0xc0 == 11000000 in binary. Thus, there are 4 possibilities in the last byte for anything on those subnets:

00xxxxxx 01xxxxxx
10xxxxxx 11xxxxxx

A /27 would be 255.255.255.224, which is 0xffffffe0. 0xe0 == 11100000. Machines on this would have a last byte like:

000xxxxx 001xxxxx
010xxxxx 011xxxxx
100xxxxx 101xxxxx
110xxxxx 111xxxxx

And so on. I suspect the Wikipedia topic on Subnetworks has more and probably explains it better.

share|improve this answer
    
So if i understand this correctly, a host in dept x can have 192.168.0.1/24 and a host in dept y can have 192.168.0.1? Also another point which confused me a bit was if i want to make 2 subnets from the subnet 192.168.0.128/25 , i end up with 192.168.0.128/26 and 192.168.0.192/26 .. is this correct? –  SM Apr 19 '10 at 7:49
    
No. Well, maybe. However, the two physical networks (or through a router) cannot overlap. RFC1918 (192.168.0.0/16) IP addresses need to be distinct in a "broadcast domain" -- like an Ethernet segment. The network mask length tells hosts on that subnet when to use the router and when not to, put simply. Addresses that are routed or global within a local network must be distinct. –  Michael Graff Apr 19 '10 at 8:16
add comment

Here is 192.168.0.0 /24 sub-netted to give two subnets with two hosts, leaving the largest available nets for further subnetting.

 192.168.0.0  /25 -> 126  (128) ++
 192.168.0.128  /26 -> 62  (64)
 192.168.0.192  /27 -> 30  (32)
 192.168.0.224  /28 -> 14  (16)
 192.168.0.240  /29 -> 6  (8)
 192.168.0.248  /30 -> 2  (4) < two host
 192.168.0.252  /30 -> 2  (4) < two host
share|improve this answer
add comment

If you wanted 2, 2 host networks on the 10 net

 Network             DirectedBroadcast   CIDR Mask                UsableHosts 
 10.0.0.0            10.127.255.255      9    255.128.0.0         8,388,606   AVL
 10.128.0.0          10.191.255.255      10   255.192.0.0         4,194,302   AVL
 10.192.0.0          10.223.255.255      11   255.224.0.0         2,097,150   AVL
 10.224.0.0          10.239.255.255      12   255.240.0.0         1,048,574   AVL
 10.240.0.0          10.247.255.255      13   255.248.0.0         524,286     AVL
 10.248.0.0          10.251.255.255      14   255.252.0.0         262,142     AVL
 10.252.0.0          10.253.255.255      15   255.254.0.0         131,070     AVL
 10.254.0.0          10.254.255.255      16   255.255.0.0         65,534      AVL
 10.255.0.0          10.255.127.255      17   255.255.128.0       32,766      AVL
 10.255.128.0        10.255.191.255      18   255.255.192.0       16,382      AVL
 10.255.192.0        10.255.223.255      19   255.255.224.0       8,190       AVL
 10.255.224.0        10.255.239.255      20   255.255.240.0       4,094       AVL
 10.255.240.0        10.255.247.255      21   255.255.248.0       2,046       AVL
 10.255.248.0        10.255.251.255      22   255.255.252.0       1,022       AVL
 10.255.252.0        10.255.253.255      23   255.255.254.0       510         AVL
 10.255.254.0        10.255.254.255      24   255.255.255.0       254         AVL
 10.255.255.0        10.255.255.127      25   255.255.255.128     126         AVL
 10.255.255.128      10.255.255.191      26   255.255.255.192     62          AVL
 10.255.255.192      10.255.255.223      27   255.255.255.224     30          AVL
 10.255.255.224      10.255.255.239      28   255.255.255.240     14          AVL
 10.255.255.240      10.255.255.247      29   255.255.255.248     6           AVL
 10.255.255.248      10.255.255.251      30   255.255.255.252     2           REQ 2
 10.255.255.252      10.255.255.255      30   255.255.255.252     2           REQ 2
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.