What a /0 subnet is: the default route
A /0 matches every IPv4 address in existence. It is not a subnet you assign, it is how a routing table says everything not covered by another entry.
At a glance
- Subnet mask
- 0.0.0.0
- Wildcard mask
- 255.255.255.255
- Total addresses
- 4,294,967,296
- Usable hosts
- 4,294,967,294
- Contains
- 16,777,216 networks of /24
- Host bits
- 32 of 32
In detail
Zero prefix bits means zero bits have to match, so 0.0.0.0/0 covers all 4,294,967,296 IPv4 addresses. Longest-prefix matching is what stops it swallowing everything: a router picks the most specific route that matches, and /0 is the least specific route possible.
It appears in three places you meet daily: the default gateway in a routing table, a firewall rule that means any source, and a security group that has been opened to the whole internet.
When you see 0.0.0.0/0 in a security group or firewall rule for an inbound port, that is the whole internet. For SSH or a database port, that is almost always the finding you are looking for.
Examples
# default route via the gateway
ip route add default via 192.168.1.1
# inbound rule that allows the entire internet
allow tcp 22 from 0.0.0.0/0Things that catch people out
- 0.0.0.0/0 as a route destination and 0.0.0.0 as a bind address look similar and mean different things. Binding a service to 0.0.0.0 means listen on every local interface, not route everywhere.
- A /0 route does not beat a more specific route. If traffic is not going where you expect, look for a longer prefix that also matches.
Try it: IP Subnet Calculator
Enter any IPv4 address with a prefix or a dotted mask and get the network address, broadcast address, wildcard mask, usable host range, address class, and the hex and binary forms.
IP Subnet Calculator
LOCAL · Browser-OnlyCalculate IP subnet details, network ranges, and CIDR notation
192.168.1.0192.168.1.255255.255.255.00.0.0.255192.168.1.0/24192.168.1.1 - 192.168.1.254192.168.1.1192.168.1.254256254C0xC0A8016411000000.10101000.00000001.01100100Split into two /25 subnets
Dividing 192.168.1.0/24 one prefix deeper.
Common Subnet Masks
Related IPv4 subnets
All ipv4 subnets →What a /8 subnet is: a full class A block
A /8 uses the mask 255.0.0.0 and gives 16,777,214 usable addresses. What it is for and where it goes wrong.
What a /32 subnet is: a single host
A /32 uses the mask 255.255.255.255 and gives 1 usable addresses. What it is for and where it goes wrong.
What a /24 subnet is: the classic LAN subnet
A /24 uses the mask 255.255.255.0 and gives 254 usable addresses. What it is for and where it goes wrong.
What a /4 subnet is: the multicast block
A /4 uses the mask 240.0.0.0 and gives 268,435,454 usable addresses. What it is for and where it goes wrong.
What a /10 subnet is: the carrier-grade NAT block
A /10 uses the mask 255.192.0.0 and gives 4,194,302 usable addresses. What it is for and where it goes wrong.
What a /12 subnet is: the 172.16 private block
A /12 uses the mask 255.240.0.0 and gives 1,048,574 usable addresses. What it is for and where it goes wrong.
Tools for this
- IP Subnet Calculator Free online IP subnet calculator - calculate IP subnet details, CIDR notation, and network address ranges
- IP Address Lookup Free online IP address lookup - find your public IP address and basic network information
- Number Base Converter Free online number base converter - convert numbers between decimal, binary, octal, and hexadecimal