11

I know that 0.0.0.0/0 represents a default route. But I would like to understand what does 0.0.0.0/1 represents? Is it even a valid thing in networking?

1

3 Answers 3

16

0.0.0.0 is no valid IP address, regardless of prefix length. 0.0.0.0/0 as prefix matches any address, so it's used for the default route. Also, 0.0.0.0 is the unspecified address used in many APIs, indicating 'all local addresses'.

A 0.0.0.0/1 prefix matches any address from 0.0.0.0 to 127.255.255.255 (practically 1.0.0.0 to 126.255.255.255; 0.0.0.0/8 is reserved for IANA special use and generally invalid, 127.0.0.0/8 is reserved for local loopback) - if that makes sense for you. I've seen at least one instance of crude 'load balancing' with two WAN uplinks where one was used for 0.0.0.0/1 and the other for 128.0.0.0/1.

0.0.0.0/8 and 0.0.0.0/32 specifically are reserved by RFC 1122 section 3.2.1.3.

10
  • 1
    So the CIDR representation - 0.0.0.0/1 is practically used to represent an IP addresses range - 1.0.0.0 to 126.255.255.255, is that right?
    – Deepak
    Nov 14, 2022 at 14:09
  • 1
    Yes, I've made that clearer in the answer.
    – Zac67
    Nov 14, 2022 at 14:33
  • 2
    0.0.0.0/0 is the only prefix that matches any address, so yes.
    – Zac67
    Nov 14, 2022 at 14:39
  • 3
    I've also seen the CIDR pair 0.0.0.0/1 and 128.0.0.0/1 being using to apply a reversible route to 0.0.0.0/0. This is typically done on vpn-up/down.sh scripts.
    – Aron
    Nov 15, 2022 at 3:36
  • 1
    @user253751 With a prefix shorter than /24, the .0 address might not be anything special. It's the all-host-bits-zero address that's largely unusable with IPv4.
    – Zac67
    Nov 15, 2022 at 7:37
21

Zac is muddying the waters by excluding 0.0.0.0/8 and 127.0.0.0/8. While addresses in those two prefixes should never appear on the wire, 0.0.0.0/1 does cover them. The slash notation works the same for zero and one as it does for any number from 0 to 32, inclusive. "The number of bits that matter." One bit means 0-127, and 128-255; since you stated 0.0.0.0/1, it's the former [addresses 0.0.0.0 through 127.255.255.255, or in hex 00000000 - 7FFFFFFF]

It's a common trick of VPN software to use 0/1 and 128/1 routes as more specific than the (0/0) default route, without having to muck with other processes (eg. DHCP - if you mess with the routes DHCP installed, it will reinstall them when the lease renews.)

(But otherwise, yes, 0.0.0.0 is not a legal interface address.)

2
  • I would add that the pair of CIDRs allow you to "override" 0.0.0.0/0 without "overwriting" you 0.0.0.0/0 route.
    – Aron
    Nov 15, 2022 at 3:38
  • 1
    That's what the second paragraph says.
    – Ricky
    Nov 15, 2022 at 23:49
6

0.0.0.0/1 is not an IP address per-se, it's the combination of an IP address and a prefix length in CIDR notation. It represents the range of addresses from 0.0.0.0 to 127.255.255.255.

There are a few places it might crop-up.

  1. It's the CIDR notation for the block of addresses that were formerly known as class A (class B is 128.0.0.0/2, class C is 192.0.0.0/3 class D is 224.0.0.0/4 and class E is 240.0.0.0/4) .
  2. As Zac97 suggests it may be used as a crude approach to load balancing, with 0.0.0.0/1 pointed at one link and 128.0.0.0/1 pointed at another link to use each link for (very roughly) half of destinations.
  3. Some VPN software, notably openvpn, uses a pair of routes for 0.0.0.0/1 and 128.0.0.0/1 to effectively override the default gateway without modifying or removing it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.