0

I am trying to understand subnetting. I understand that you can take the 192.168.0.0/24 domain and break it into 2 subnets: 192.168.0.0/25 and 192.168.0.128/25. 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 doesn't seem right, I am moving down like a tree, however the subnet mask and IPs are being repeated, I am just adding 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.

5
  • 3
  • @Zoredache, that book you referred to might be more reading than SM was planing to do. ;) Apr 19, 2010 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, 2010 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, 2010 at 16:06
  • It appears subtlety has been wasted. Apr 19, 2010 at 22:07

3 Answers 3

10

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.

2
  • 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, 2010 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. Apr 19, 2010 at 8:16
1

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
0

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