Networking
IP Addressing
Subnetting
IPv4
IPv6

What does 0.0.0.0/0 mean? (and ::/0)

Codemia Knowledge Hub ·

0.0.0.0/0 means "all IPv4 addresses," and ::/0 means "all IPv6 addresses." The /0 is CIDR notation for zero network prefix bits, so the range covers the entire address space. You mostly see it as the default route in routing tables and as the "anywhere" match in firewall rules and security groups.

How the notation breaks down

The address part

0.0.0.0 is the "unspecified" IPv4 address. In a routing context it acts as a wildcard that matches any IP address. :: is the unspecified IPv6 address (shorthand for 128 zero bits).

The /0 CIDR suffix

CIDR (Classless Inter-Domain Routing) uses a suffix like /24, /16, or /0 to say how many leading bits define the network portion of an address.

CIDRNetwork BitsHost BitsNumber of Addresses
/323201 (single host)
/24248256
/16161665,536
/882416,777,216
/00324,294,967,296 (all IPv4 addresses)

With /0, no bits belong to the network, so all 32 bits are "don't care" bits and the range matches every IPv4 address from 0.0.0.0 to 255.255.255.255.

The equivalent subnet mask is 0.0.0.0. A bitwise AND of any IP address with 0.0.0.0 yields 0.0.0.0, which is why every address matches.

0.0.0.0/0 as the default route

When a router gets a packet and no more specific route matches the destination, it falls back to the default route, 0.0.0.0/0.

bash
1# View the routing table on Linux
2ip route show
3
4# Typical output:
5default via 192.168.1.1 dev eth0
6192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.100

The default entry is 0.0.0.0/0: "for any destination not explicitly listed, send the packet to 192.168.1.1."

To add or modify the default route explicitly:

bash
1# Linux: Add a default route
2sudo ip route add 0.0.0.0/0 via 192.168.1.1 dev eth0
3
4# macOS: Add a default route
5sudo route add -net 0.0.0.0/0 192.168.1.1
6
7# Windows: Add a default route
8route add 0.0.0.0 mask 0.0.0.0 192.168.1.1

Without a default route, a machine cannot reach anything outside its directly connected networks, which is why losing it breaks internet access.

Longest prefix match

With several routes, the router picks the longest matching prefix. The default route (/0) has the shortest possible prefix, so it is always the last resort:

bash
1# Example routing table
210.0.1.0/24     via 10.0.0.1    # Matches 10.0.1.* (most specific)
310.0.0.0/16     via 10.0.0.2    # Matches 10.0.* (less specific)
40.0.0.0/0       via 192.168.1.1 # Matches everything (least specific, default)

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: the only match, so it goes to the default gateway

0.0.0.0/0 in firewall and security group rules

In firewall configurations, 0.0.0.0/0 means "any source" or "any destination."

AWS Security Groups

 
Type        Protocol  Port   Source
SSH         TCP       22     0.0.0.0/0    (allows SSH from ANY IPv4 address)
SSH         TCP       22     10.0.0.0/8   (allows SSH only from 10.x.x.x)

iptables (Linux)

bash
1# Allow HTTP from any source
2sudo iptables -A INPUT -p tcp --dport 80 -s 0.0.0.0/0 -j ACCEPT
3
4# Block all incoming traffic from any source (then whitelist)
5sudo iptables -P INPUT DROP
6sudo iptables -A INPUT -s 192.168.1.0/24 -j ACCEPT

Cloud platforms

PlatformWhere You See 0.0.0.0/0Meaning
AWS Security GroupsInbound/Outbound rules sourceAllow/deny from all IPv4
GCP Firewall RulesSource rangesMatch all IPv4 sources
Azure NSGSource address prefixAll IPv4 addresses
Kubernetes NetworkPolicyipBlock.cidrAll pod/external traffic

Binding a server to 0.0.0.0

A server that binds to 0.0.0.0 (no CIDR suffix) listens on all available network interfaces:

python
1# Python: Listen on all interfaces, port 8080
2import socket
3
4server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
5server.bind(("0.0.0.0", 8080))  # accepts connections from any interface
6server.listen(5)
javascript
1// Node.js: Express listening on all interfaces
2app.listen(3000, "0.0.0.0", () => {
3  console.log("Listening on all interfaces");
4});
Bind AddressAccepts Connections From
127.0.0.1Same machine only (loopback)
0.0.0.0Any network interface (local, LAN, internet)
Specific IP like 192.168.1.5Only through that interface

IPv6 equivalents

IPv4IPv6Meaning
0.0.0.0/0::/0All addresses (default route)
0.0.0.0::Unspecified address
127.0.0.1::1Loopback address
0.0.0.0/0 in firewall::/0 in firewallAllow/deny all IPv6

On dual-stack networks (IPv4 and IPv6), firewall rules need both 0.0.0.0/0 and ::/0 to cover all traffic:

bash
# AWS Security Group: Allow HTTPS from anywhere
Inbound Rule 1: HTTPS, TCP, 443, 0.0.0.0/0   (IPv4)
Inbound Rule 2: HTTPS, TCP, 443, ::/0          (IPv6)

Mistakes with 0.0.0.0/0

  • Opening SSH (port 22) to 0.0.0.0/0 in production. That allows SSH from any IP on the internet. Restrict it to your office IP range or use a bastion host. Cloud providers like AWS warn when you do this.
  • Confusing 0.0.0.0/0 with 0.0.0.0. The first is a CIDR range meaning "all addresses." The second is the unspecified address, used for server binding or as a source in DHCP requests.
  • Forgetting ::/0 on dual-stack hosts. Rules with only 0.0.0.0/0 do not cover IPv6, so traffic can bypass them over IPv6 if the server has an IPv6 address.
  • Deleting the default route. The machine can no longer reach anything outside its local subnet, and on a remote server that locks you out. Have console access before modifying routes.
  • Reading /0 as "no network." It means zero network bits, not zero addresses. It is the opposite of /32 (a single host): /0 covers the maximum range, /32 the minimum.

Course
Beginner
27 lessons
10 hours
System Design Fundamentals

Build a strong foundation in designing scalable, reliable distributed systems.

View the course
System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design