# Which ranges of IPv4 addresses cannot be expressed in prefix notation? [duplicate]

I was trying to do an exercise where we have a range of IPv4 addresses and we need to convert it both to "prefix notation", e.g. a.b.c.d/x, and to "address/mask".

Now, apparently, the following range 121.34.56.64–121.34.56.128 can neither expressed in prefix notation nor in address/mask. Why is that? I mean, they have the first 24 bits in common, so I would express the range as 121.34.56.64/24 in prefix notation.

Other ranges that I do not understand why they cannot be assigned a prefix notation and an address/mask notation:

• 128.131.9.0–128.131.9.192
• 93.20.10.0–93.20.11.0
• 128.242.138.0–128.242.139.127

Maybe I am just confused about how these prefixes and masks are obtained. So, in general, which ranges cannot be expressed in prefix notation and prefix/mask notation? Is there a time where it is possible to express a range in prefix notation but not in prefix-mask (or vice-versa)?

The issue is that you end up comparing unequal things when you say "I would express the range as 121.34.56.64/24 in prefix notation"

The range 121.34.56.64 to 121.34.56.128 is contained in 121.34.56.64/24 (which is actually the 256 IPs from 121.34.56.0 to .255), but the two are not equivalent.

The reason that 121.34.56.64-128 cannot be expressed as a single prefix is because of that last 128 IP. Up to 127, the 25th bit of the IP is a 0. At 128 it becomes a 1.

As a result, a single mask covering all those IPs can only be at most 24 bits long, and that results in a longer IP range than you are looking for. So the best you can do would be 121.34.56.64/26 (from .64 to .127) and then add a .32 to cover that last .128.

The other examples are similar. If you manage to find a single mask that covers all the IPs in the range, you will find that it also covers a bunch of other IPs before or after the ones you want. So to cover these ranges exactly, you need to assemble several smaller IP ranges.

representing the IPV4 by address MASK , prefix or wildcard mask all are equivalent but its depend on two things
1- if you follow classful or classless IPV4 presentation , for example if you follow classful style to present the IPV4 ,you can't present 121.34.56.X/24 OR 121.34.56.0 mask 255.255.255.0 because it is class A , as you know class A is 255.0.0.0 mask or /8 prefix .
2- the command on the IOS you will configure this IPV4 for it , for example you can't present IPV4 in form of IP/Prefix for certain interface in IOS but you can do so in NXOS , for EIGRP IPV4 configuration should occur in form of address and wildcard mask.

You must distinguish "ip range" and "ip network".

Those terms are commonly used for IP networks, but they are not equivalent.

An IP range is any number of contiguous IP addresses.

192.168.1.1-192.168.1.10 is a range. but it's not a network, so it cannot be written with neither a prefix or a subnet mask notation.

192.168.1.0/24 is a network (it contain the range of ip addresses 192.168.1.0 - 192.168.1.255)

121.34.56.64 - 121.34.56.128 is also a range and not a network. The nearest network is 121.34.56.64/26 which contains the range 121.34.56.64-121.34.56.127 (and not 128).

Or you could write it as the sum of 2 networks : 121.34.56.64/26 and 121.34.45.128/32 (this network contain only 1 IP address)

-edited- 93.20.10.0–93.20.11.0 is not a network

128.242.138.0–128.242.139.127 corresond to 2 networks : 128.242.138.0/24 and 128.242.139/25

If you use Windows, download the solarwinds subnet calculator (it's free) to easilly see networks boundaries. You can find other network calculators online.

Now, apparently, the following range 121.34.56.64–121.34.56.128 can neither expressed in prefix notation nor in address/mask. Why is that? I mean, they have the first 24 bits in common, so I would express the range as 121.34.56.64/24 in prefix notation.

Because 121.34.56.64/24 includes the range 121.34.56.64–121.34.56.128 but ALSO includes OTHER addresses not belonging to the range 121.34.56.64–121.34.56.128.

Maybe I am just confused about how these prefixes and masks are obtained. So, in general, which ranges cannot be expressed in prefix notation and prefix/mask notation?

You can write a range A-B as prefix notation when:

1. The first address A of the range has a sequence of H x 0's bits as least significant bits.
2. The last address B of the range shares all the same (32-H) bits from A, AND has H x 1's for the least significant bits.

For instance:

``````A = 1.1.240.0 = 00000001.00000001.11110000.00000000
B = 1.1.243.255 = 00000001.00000001.11110011.11111111
H = 10 bits
``````

So you can write A-B as A/(32-H): 1.1.240.0-1.1.243.255 as 1.1.240.0/22

Is there a time where it is possible to express a range in prefix notation but not in prefix-mask (or vice-versa)?

No.