I thought it means all IP addresses. But then I encountered this in an AWS cert book:
Create a subnet route table rule to send all non-local traffic (0.0.0.0/0) to the IGW
and later:
You can scope the route to all destinations not explicitly known to the route table (0.0.0.0/0), or you can scope to a narrower range of IP addresses, […]
So does 0.0.0.0/0 mean all non-local IP addresses? Or is this the case only in some contexts such as AWS VPCs?
Local traffic means within the same subnet. If a destination is local it’s going to go directly to the destination. If it’s not local then it’s going to look at your route table to see where to go and you can create a single route 0.0.0.0/0, which means all IPs, send to the gateway.
Routing (in general) works off a route table which is a list of routes and the first matching route is what is used. For AWS there is a ‘local’ route that always come first.
0.0.0.0/0 means, effectively, all-wild-card. So traffic going anywhere is re-directed to the Internet Gateway. Which is exactly what you want to access the internet
Be aware, on a security group, a 0.0.0.0/0 rule on the INCOMING traffic means anyone anywhere can connect via the specified port.
In the context of the way routing tables get set up by default on AWS, 0.0.0.0/0 is effectively “all non local addresses”. This is because another route presumably exists in the routing table to route the VPC subnet to the local network on the VPC.
0.0.0.0/0 is also known as default. You can call it “everything else” other than what is already specified in your routing table.
With IP routing there is a concept of “more specific route”. 0.0.0.0/0 is the most common network with all addresses from 0.0.0.0 to 255.255.255.255. 192.168.0.0/16 is inside it, but is more specific, covering addresses between 192.168.0.0 and 192.168.255.255. 192.168.1.0/24 would be even more specific to it covering only addresses 192.168.1.0-192.168.1.255. The traffic is routed according to the most specific route.
You can have nested networks and routes that all might lead to different destinations. You might decide to route 192.168.0.0/16 to your VPN gateway that leads towards your corporate network, at the same time have route 192.168.0.0/24 (or 192.168.100.0/24, which is also inside the big 192.168.0.0/16) that goes to an instance which then could do something for that traffic, then you can have a couple subnets 192.168.1.0/24 and 192.168.2.0/24 which will be routed locally. You can have VPC Peering set up towards another VPC which would be a route to 10.0.0.0/8. And on top of that. Everything else, everything that is outside of these destinations, is still inside 0.0.0.0/0.
This is an excellent explanation. For more information, look up CIDR. In general 0.0.0.0/0 implies all IP addresses. For a very specific IP address, you would use 1.2.3.4/32. Any number can go after the /. For every 8 you go down, you expose another octet. So for example,
1.2.3.0/24 would mean any IP address that starts with 1.2.3
1.2.0.0/16 would mean any IP address that starts with 1.2.
1.0.0.0/8 would mean any IP address that starts with 1.
You even do halves, quarters, etc.
1.2.3.0/28 would mean any IP matching 1.2.3.[0-127]
1.2.3.128/28 would mean any IP matching 1.2.3.[128-255]