What does 0.0.0.0/0 and /0 mean?
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
0.0.0.0/0 means "all IPv4 addresses." The ::/0 equivalent means "all IPv6 addresses." The /0 suffix is CIDR notation indicating that zero bits are used for the network prefix, so the entire address space is covered. These notations are most commonly used as the default route in routing tables and as wildcard matches in firewall rules and security group configurations.
Breaking Down the Notation
The IP Address Part
0.0.0.0 is the "unspecified" IPv4 address. In routing context, it acts as a wildcard that matches any IP address. Similarly, :: is the unspecified IPv6 address (shorthand for 128 zero bits).
The /0 CIDR Suffix
CIDR (Classless Inter-Domain Routing) notation uses a suffix like /24, /16, or /0 to indicate how many leading bits define the network portion of an address.
| CIDR | Network Bits | Host Bits | Number of Addresses |
/32 | 32 | 0 | 1 (single host) |
/24 | 24 | 8 | 256 |
/16 | 16 | 16 | 65,536 |
/8 | 8 | 24 | 16,777,216 |
/0 | 0 | 32 | 4,294,967,296 (all IPv4 addresses) |
With /0, zero bits are allocated to the network, so all 32 bits are "don't care" bits. The result: it matches every possible IPv4 address from 0.0.0.0 to 255.255.255.255.
The subnet mask equivalent of /0 is 0.0.0.0. Performing a bitwise AND of any IP address with 0.0.0.0 yields 0.0.0.0, confirming that every address matches.
Use Case 1: Default Route in Routing Tables
The most common use of 0.0.0.0/0 is as the default route. When a router receives a packet and no more specific route matches the destination, it falls back to the default route.
The default entry is equivalent to 0.0.0.0/0. It tells the system: "For any destination not explicitly listed, send the packet to 192.168.1.1."
You can add or modify the default route explicitly:
Without a default route, your machine cannot reach any address outside its directly connected networks. This is why losing the default route makes internet access fail.
Use Case 2: Firewall and Security Group Rules
In firewall configurations, 0.0.0.0/0 means "any source" or "any destination."
AWS Security Groups
iptables (Linux)
Cloud Platform Examples
| Platform | Where You See 0.0.0.0/0 | Meaning |
| AWS Security Groups | Inbound/Outbound rules source | Allow/deny from all IPv4 |
| GCP Firewall Rules | Source ranges | Match all IPv4 sources |
| Azure NSG | Source address prefix | All IPv4 addresses |
| Kubernetes NetworkPolicy | ipBlock.cidr | All pod/external traffic |
Use Case 3: Server Binding Address
When a server binds to 0.0.0.0 (without the CIDR suffix), it listens on all available network interfaces:
Binding to 0.0.0.0 vs 127.0.0.1:
| Bind Address | Accepts Connections From |
127.0.0.1 | Same machine only (loopback) |
0.0.0.0 | Any network interface (local, LAN, internet) |
Specific IP like 192.168.1.5 | Only through that interface |
IPv6 Equivalents
Every IPv4 concept above has an IPv6 counterpart:
| IPv4 | IPv6 | Meaning |
0.0.0.0/0 | ::/0 | All addresses (default route) |
0.0.0.0 | :: | Unspecified address |
127.0.0.1 | ::1 | Loopback address |
0.0.0.0/0 in firewall | ::/0 in firewall | Allow/deny all IPv6 |
In dual-stack networks (supporting both IPv4 and IPv6), you need both 0.0.0.0/0 and ::/0 in your firewall rules to cover all traffic:
Routing Table Deep Dive
When a router has multiple routes, it uses longest prefix match to determine which route to use. The default route (/0) has the shortest prefix, so it is always the last resort:
For a packet destined to 10.0.1.5:
- Matches
10.0.1.0/24(24-bit prefix) - wins, most specific - Matches
10.0.0.0/16(16-bit prefix) - Matches
0.0.0.0/0(0-bit prefix)
For a packet destined to 8.8.8.8:
- Does not match
10.0.1.0/24 - Does not match
10.0.0.0/16 - Matches
0.0.0.0/0- only match, used as default gateway
Common Pitfalls
- Opening port 22 (SSH) to
0.0.0.0/0in production: This allows SSH access from any IP on the internet. Restrict SSH to your office IP range or use a bastion host. Cloud providers like AWS show a warning when you do this. - Confusing
0.0.0.0/0with0.0.0.0:0.0.0.0/0is a CIDR range meaning "all addresses."0.0.0.0alone (without the/0) is the unspecified address, used for server binding or as a source in DHCP requests. Context matters. - Forgetting
::/0in dual-stack environments: If you only add0.0.0.0/0to your firewall rules, IPv6 traffic is not covered. Attackers can bypass your rules via IPv6 if your server has an IPv6 address. - Deleting the default route: Removing the
0.0.0.0/0route makes your machine unable to reach anything outside its local subnet. On a remote server, this locks you out. Always have console access before modifying routes. - Assuming
/0means "none" or "no network": The/0means zero network bits, not zero addresses. It is the opposite of/32(single host)./0covers the maximum range,/32covers the minimum.
Summary
0.0.0.0/0means all IPv4 addresses.::/0means all IPv6 addresses.- The
/0CIDR suffix means zero bits are used for the network prefix, matching the entire address space. - In routing tables,
0.0.0.0/0is the default route: the gateway of last resort when no more specific route matches. - In firewall and security group rules,
0.0.0.0/0means "any source" or "any destination." Use it cautiously in inbound rules. - When binding a server to
0.0.0.0, it listens on all network interfaces. Use127.0.0.1for local-only access. - In dual-stack networks, always configure both
0.0.0.0/0(IPv4) and::/0(IPv6) rules.

