Loopback (127.0.0.1) and Link-Local (169.254.x.x) Addresses
What loopback and link-local addresses are, how they differ, and why 169.254.169.254 is one of the most important IPs in cloud computing.
Loopback: 127.0.0.0/8
The entire 127.0.0.0/8 range is reserved for loopback. Packets sent to any 127.x.x.x address are handled by the operating system and never transmitted on any network interface.
| Most common | 127.0.0.1 | The canonical "localhost" address |
| Also valid | 127.0.0.2 – 127.255.255.254 | All route back to localhost |
| Block | 127.0.0.0/8 | RFC 5735 — 16.7 million reserved |
curl http://127.0.0.1:8080/
curl http://localhost:8080/ # same thing — resolves to 127.0.0.1
Link-Local: 169.254.0.0/16
Link-local addresses are valid only within a single network link (LAN segment). They cannot be routed — a router will never forward a 169.254.x.x packet.
APIPA on Windows
When a Windows machine fails to get an IP from DHCP, it auto-assigns itself an address in 169.254.0.0/16 (Automatic Private IP Addressing). This lets it communicate on the local LAN only. A 169.254.x.x address on a Windows PC almost always means the DHCP server is unreachable.
169.254.169.254 — Cloud IMDS
The single most important link-local IP in cloud computing. AWS, Azure, and GCP all use
169.254.169.254
as the Instance Metadata Service endpoint. From any cloud VM:
curl http://169.254.169.254/latest/meta-data/placement/region
# AWS IMDSv2 — session-oriented (more secure)
TOKEN=$(curl -X PUT "http://169.254.169.254/latest/api/token" \
-H "X-aws-ec2-metadata-token-ttl-seconds: 21600")
curl -H "X-aws-ec2-metadata-token: $TOKEN" \
http://169.254.169.254/latest/meta-data/
This IP is only accessible from within the cloud instance — it is not reachable from outside. Credential-stealing attacks from compromised containers target this endpoint. AWS IMDSv2 (session tokens) was introduced to mitigate SSRF attacks against IMDS.
FAQ
What is 127.0.0.1?
127.0.0.1 is the standard IPv4 loopback address — "localhost". Any connection to 127.0.0.1 stays on the local machine and never goes to the network.
What causes a 169.254.x.x IP on Windows?
APIPA (Automatic Private IP Addressing) — triggered when Windows cannot reach a DHCP server. The 169.254.x.x address allows basic LAN communication but no internet access. Fix: check DHCP server, cable, or Wi-Fi connection.
What is 169.254.169.254?
The Instance Metadata Service (IMDS) endpoint used by all major cloud providers (AWS, Azure, GCP). Only accessible from within a cloud VM, it returns instance metadata including IAM credentials, instance ID, and region.