0

I'm studying for certification and during a simulation I stumbled in question that made me realize I wasn't so sure about calculating IPs and masks stuff.

There it is:

A company has a forest with 4 sites. Subnets are as follows:

MainOffice 172.16.1.0 Subnet: 255.255.255.0 Gateway 172.16.1.254 
Site1 192.168.12.0 Subnet: 255.255.255.0 
Site 2 192.168.13.0 Subnet: 255.255.255.0 
Site 3 192.168.14.0 Subnet: 255.255.255.0 
Site 4 192.168.15.0 Subnet: 255.255.255.0

You add a new server to the MainOffice and it needs to be able to communicate to all sites. Which route command would you run?

route add -p 192.168.12.0 netmask 255.255.240.0 172.16.1.254
route add -p 192.168.8.0 netmask 255.255.252.0 172.16.1.254
route add -p 192.168.0.0 netmask 255.255.248.0 172.16.1.254
route add -p 192.168.12.0 netmask 255.255.252.0 172.16.1.254

I know the answer of the question, but I don't know how to get to the netmask based only in the usable IPs 192.168.12.0, 192.168.13.0, 192.168.14.0 and 192.168.15.0.

I used an IP calculator to discover that 192.160.12.1 to 192.160.15.254 is 255.255.252.0 and the Subnet mask in bites is 22, but how to calculate this in an exam? Can someone enlighten me, please??!!

1
  • The point is that I didn't know that it was a /22 without the calculator shows me. That's what I don't know how to do. Nov 15, 2015 at 18:17

2 Answers 2

3

Think of all these networks as prefixes, and the netmasks just a verbose, outdated way of writing the prefix length (in your case, all four networks are /24’s).

Now since you need one route that matches all four networks (aka supernet or aggregate route), you’ll have to determine the prefix that is identical across all four.

One way of doing this is by writing out the first network’s first address, and last network's last address, and count matching bits starting from left:

192.168.12.0:    11000000 10101000 00001100 00000000
192.168.15.255:  11000000 10101000 00001111 11111111
                 ^^^^^^^^ ^^^^^^^^ ^^^^^^-- -------- 22 bits

Another is to write out all network addresses in binary, and count the matching bits. This may sometimes make it easier to spot holes between nets:

192.168.12.0/24:  11000000 10101000 00001100 xxxxxxxx
192.168.13.0/24:  11000000 10101000 00001101 xxxxxxxx
192.168.14.0/24:  11000000 10101000 00001110 xxxxxxxx
192.168.15.0/24:  11000000 10101000 00001111 xxxxxxxx
                  ^^^^^^^^ ^^^^^^^^ ^^^^^^-- 22 bits

Either way that’s /22, the prefix length for the route, and all the identical bits amount to 192.168.12.0/22 – now convert it to a netmask, 255.255.252.0.


(Of course, to save time, you can immediately mark 192.168 as 2×8 identical bits, and only write out 12.015.255 in binary.)

-2

See this cheat sheet:

255.255.255.255  11111111.11111111.11111111.11111111  /32  Host (single addr)
255.255.255.254  11111111.11111111.11111111.11111110  /31  Unuseable
255.255.255.252  11111111.11111111.11111111.11111100  /30    2  useable
255.255.255.248  11111111.11111111.11111111.11111000  /29    6  useable
255.255.255.240  11111111.11111111.11111111.11110000  /28   14  useable
255.255.255.224  11111111.11111111.11111111.11100000  /27   30  useable
255.255.255.192  11111111.11111111.11111111.11000000  /26   62  useable
255.255.255.128  11111111.11111111.11111111.10000000  /25  126  useable
255.255.255.0    11111111.11111111.11111111.00000000  /24 "Class C" 254 useable

255.255.254.0    11111111.11111111.11111110.00000000  /23    2  Class C's
255.255.252.0    11111111.11111111.11111100.00000000  /22    4  Class C's
255.255.248.0    11111111.11111111.11111000.00000000  /21    8  Class C's
255.255.240.0    11111111.11111111.11110000.00000000  /20   16  Class C's
255.255.224.0    11111111.11111111.11100000.00000000  /19   32  Class C's
255.255.192.0    11111111.11111111.11000000.00000000  /18   64  Class C's
255.255.128.0    11111111.11111111.10000000.00000000  /17  128  Class C's
255.255.0.0      11111111.11111111.00000000.00000000  /16  "Class B"

255.254.0.0      11111111.11111110.00000000.00000000  /15    2  Class B's
255.252.0.0      11111111.11111100.00000000.00000000  /14    4  Class B's
255.248.0.0      11111111.11111000.00000000.00000000  /13    8  Class B's
255.240.0.0      11111111.11110000.00000000.00000000  /12   16  Class B's
255.224.0.0      11111111.11100000.00000000.00000000  /11   32  Class B's
255.192.0.0      11111111.11000000.00000000.00000000  /10   64  Class B's
255.128.0.0      11111111.10000000.00000000.00000000  /9   128  Class B's
255.0.0.0        11111111.00000000.00000000.00000000  /8   "Class A"

Class C (in old classful networks) is your standard home network and makes a good starting point. Each bit is a power of 2 so you double or half depending on whether you're going "up" or "down".

In an exam the easiest thing is to learn:

255.255.255.0      /24 "Class C" 254 usable

Write that in the middle of a page, then above it write the rest, then below. Follow the pattern of +-1 to CIDR notation (/) and half double to usable host(-network and bcast). The last octet of the mask follows a pattern thats easy to memorize.

4
  • So you are saying that transforming 192.168.12.0 in binary I have this: 11000000 10101000 00001100 00000000 So the last 10 zeros shows me that this is ending with 252.0?? Is that easy? Because the 3rd octate is not fully with 1.. that's why I wasn't sure. Nov 15, 2015 at 18:48
  • What class an address is is not dependent on the mask. Class A addresses start with 0 as the first bit, Class B addresses start with 10 as the first two bits, Class C addresses start with 110 as the first three bits, Class D addresses start with 1110 as the first four bits, and Class E addresses start with 1111 as the first four bits. You can use Class A private addressing with a /24 mask at home, but that doesn't make it a Class C address.
    – Ron Maupin
    Nov 15, 2015 at 20:10
  • 1
    Also, you have /31 as unusable, but that is just not true. RFC 3021, Using 31-Bit Prefixes on IPv4 Point-to-Point Links has allowed the use of /31 for point-to-point links for 15 years.
    – Ron Maupin
    Nov 15, 2015 at 20:20
  • Thank you very much.. now I understand how to calculate this question. I appreciate your effort in help me :) Nov 15, 2015 at 20:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .