In the history, I mostly used for "match every IP address". Recently, I saw a subnet filter.

What is the difference between and and what's the practical use of

Peter Mortensen
  • 2,318
  • 5
  • 23
  • 24
  • 361
  • 1
  • 2
  • 7
  • 2
    The most specific route (the one with the largest prefix length) is used. For the first half of the full IPv4 address range, `` would be preferred over ``. Addresses in the second half of the full IPv4 address range will not match ``. Any more specific routes will be use for traffic that falls into those ranges. – Ron Maupin May 05 '22 at 16:07

3 Answers3


The matches every IP address, whereas only matches half of them ( and requires as its pair to match the rest (

In basic routing, the smallest available subnet containing the IP address takes precedence. This rule comes from RFC 4632, 5.1. It is typical there will be overlapping networks as, for example, is part of, which is – just like any IP address – part of

Therefore, by splitting the into smaller chunks one can constrain the interface to take precedence over any other interface that has default route, without playing with metric values. This is a common technique with VPNs that would not want data to bypass the tunnel. The same logic is the reason you could still use resources from your local subnet (e.g., /24) while the VPN is on – if no other methods are used to enforce everything gets tunneled.

Likewise, the entire IPv4 address space could be divided into even smaller subnets, e.g. in four chunks:

  • (
  • (
  • (
  • (

Or eight with,,,,,, &, etc., etc.

Esa Jokinen
  • 46,944
  • 3
  • 83
  • 129

What is the difference between and matches all IPv4 addresses. matches the IP range from to

IP routing uses a "longest prefix match" rule, so if there are routes in the routing table for both and and both match the destination then the route for will be preferred.

what's the practical use of

Openvpn uses it as a trick to override the default route without modifying or removing the existing one. It would not surprise me if other VPN software does too but I haven't seen it.

Removing the exiting default route when the VPN connects and re-adding it when the VPN disconnects has the potential for race conditions with other network control or administration software. It is also likely to leave the system without network access if the VPN client crashes.

It is possible to override a route by using a lower metric, however that doesn't work if the existing route already has the lowest possible metric.

So openvpn's "redirect-gateway" feature has an option called "def1". When this option is enabled it will create routes for and rather than creating a single route for These routes will be preferred over the existing route for thanks to the "longest prefix match" rule, so there is no need to remove the existing default route.

Peter Green
  • 4,211
  • 12
  • 30
  • 2
    This answer gets closest to the "practical" use of a /1 pair - to override the default route, without replacing the default route. – chexum May 07 '22 at 07:16

The literal meaning: that is just two different networks expressed in CIDR notation.

The practical use of Splitting the IPv4 space by the first bit does not produce particularly meaningful subnets today, outside of history lessons.

It just happens to be the smallest split possible. So spelling out two halves is the shortest method to express "all of IPv4" where 0/0 is not a valid input. A script would not let me configure network topology for which it had not been designed, so I used 0/1 as a workaround (in routing context, prefix length determines preference).

Besides typos, that is the only instance where I ever encountered it.

  • 8,963
  • 5
  • 24
  • 48
  • re. the link to history lessons, I don't really see how `0/1` has anything to do with classful networks, as the classes corresponded to `/8`, `/16` and `/24` blocks. – ilkkachu May 06 '22 at 09:23
  • @ilkkachu initial /8 allocations had the most significant bit unset – anx May 06 '22 at 09:45
  • @ilkkachu in classful addressing there were no arbitrary network masks. The IPv4 unicast address space was split to sets of `/8`, `/16` and `/24` networks in a fixed manner encoded in the address itself. `` contains exactly all the Class A (`/8`) networks and nothing more. Read the Wikipedia article linked in the answer. – pabouk - Ukraine stay strong May 06 '22 at 21:07
  • @anx, right. Though as pabouk there says, there were no arbitrary masks, so no arbitrary size blocks, so it seems to me when the classes existed, it wouldn't have been possible to say Class A corresponded to `0/1`. – ilkkachu May 06 '22 at 21:51
  • @pabouk-Ukrainestaystrong, I did, it never mentions `/1`. – ilkkachu May 06 '22 at 21:51
  • 1
    @ilkkachu `0/1` means that the most significant bit (MSB) is zero and that is the definition of Class A addresses in classful network: `0nnnnnnn.HHHHHHHH.HHHHHHHH.HHHHHHHH`. `0` - fixed zero MSB, `n` - network part bits, `H` - host part bits. - Today you can compare the mask with the obsolete classes for fun. Today's masks did not exist at the time of classful networks. – pabouk - Ukraine stay strong May 06 '22 at 22:13