What 127.0.0.0/8 is
Packets to any 127.x.x.x address never leave the host. The operating system loops them back in software.
This means you can run several services on the same port by binding each to a different loopback address, e.g. one on 127.0.0.2:53 and another on 127.0.0.3:53.
Who uses it
-
systemd-resolved
Ubuntu and other systemd distros run a local DNS stub on 127.0.0.53.
-
Debian and Ubuntu hostnames
/etc/hosts often maps the machine's hostname to 127.0.1.1.
-
Local development
Developers bind test services to different 127.x addresses to avoid port clashes.
Conflicts and gotchas
- localhost inside a container. 127.0.0.1 inside a Docker container is the container itself, not the host. Use the host's bridge IP or host.docker.internal.
- Binding to 127.0.0.1 in production. A service listening only on loopback can't be reached from other machines. Bind to the real interface (or 0.0.0.0) when it needs to be.
- Blocking all of 127/8. Firewall rules that only allow 127.0.0.1 can break software using 127.0.0.53 or 127.0.1.1.
How to split 127.0.0.0/8
Worked example: into /16s
- Going from /8 to /16 borrows 16 − 8 = 8 bits from the host part.
- Each borrowed bit doubles the number of subnets: 28 = 256 subnets.
- Each /16 keeps 32 − 16 = 16 host bits: 216 = 65,536 addresses, so 65,534 usable after removing network and broadcast.
- The new mask is 255.255.0.0, so subnets step by 1 in the second octet: 127.0.0.0/16, 127.1.0.0/16, 127.2.0.0/16 … up to 127.255.0.0/16.
127.0.0.0/8 FAQ
Is 127.0.0.2 also localhost?
Yes. Every address in 127.0.0.0/8 is a loopback address on the local machine.
Can 127.0.0.0/8 be used on a network?
No. Loopback packets must never appear on a network; routers drop them.
What is the IPv6 equivalent of 127.0.0.1?
::1. IPv6 has a single loopback address, not a whole range.
Related tools
Other well-known networks: 10.0.0.0/24, 10.0.0.0/8, 100.64.0.0/10, 169.254.0.0/16, 172.16.0.0/12, 172.17.0.0/16, 192.168.0.0/16, 192.168.0.0/24, 192.168.1.0/24 · all networks