2

I have this problem that I think its hard to solve.

So, How can I know the correct last Subnet Address.

Example : 10.0.0.0 /18

Subnets = 1024 Host = 16384 - 2 = 16382 256-192 = 64

So I came up with this

10.0.0.0
10.0.64.0
10.0.128.0
 ..to..
10.?.?.?

How can I know the last subnet. Is there any formula. I don't know it because 1024 Subnets is very large to type.

jass lol
  • 23
  • 1
  • 3
  • You need to do this in binary. convert this to binary and it will be obvious. IP addresses are 32-bit binary numbers, and you should do your IP manipulations in binary, then convert back to decimal. – Ron Maupin Dec 22 '15 at 16:43
  • @RonMaupin what? what number should I convert to binary. and how can it determined the last subnet address? Im confuse now. – jass lol Dec 22 '15 at 16:45
  • By setting the subnet portion of the address to all ones, then convert back to decimal, you have your answer. If you just did a simple search on this site, you would have come up with this question which has the answer: http://networkengineering.stackexchange.com/questions/7106/how-do-you-calculate-the-prefix-network-subnet-and-host-numbers – Ron Maupin Dec 22 '15 at 16:49

1 Answers1

1

Write out the mask in binary and apply it.

00001010 . 00000000 . 00000000 . 00000000 = 10.0.0.0

Mask = 18-bits, so the maximum (aka wild card mask) is:

00000000 . 00000000 . 00111111 . 11111111 = 0.0.63.255
11111111 . 11111111 . 11000000 . 00000000 = 255.255.192.0

The left most 18 bits represent the network, while the 1's represent the hosts on the network. To find the broadcast address, just maintain whatever the first 18 bits are in the original 10.0.0.0 address, and replace the following 14 bits with 1's. In order to get the next subnet, simply increment the left hand side:

00001010 . 00000000 . 00111111 . 11111111 = 10.0.63.255/18
00001010 . 00000000 . 01111111 . 11111111 = 10.0.127.255/18
00001010 . 00000000 . 10111111 . 11111111 = 10.0.191.255/18
00001010 . 00000000 . 11111111 . 11111111 = 10.0.255.255/18

and so on...

Similarly, simply change all of the host bits (right most 14 bits in this case) with 0's while maintaining the first 18 bits' original values to find the network address.

So, the last subnet would have to be, while keeping the first octet in tact (RFC 1918 address):

00001010 . 11111111 . 11000000 . 00000000 = 10.255.192.0/18

There are no subnets that begin higher than that, assuming a /18 CIDR.

Goodies
  • 445
  • 3
  • 17
  • so is there any way that is much faster compared to that? – jass lol Dec 22 '15 at 17:22
  • If you're just trying to get the last subnet, you can simply jump to the last section. For example, if you want the last subnet of a /13, simply keep the first part for RFC 1918 compliance, change the rest of the left-most 13 to 1's, then chance the rest to 0's. This is the last subnet. So for /13, it would be 10.248.0.0 /13. – Goodies Dec 22 '15 at 17:44