Skip to content
Buy me a coffee

127.0.0.1 and localhost

tag: networkingtag: beginners

Most IP addresses point at some other device. 127.0.0.1 always points back at the computer you’re on: the traffic goes out and comes straight back in.

  • localhost is the name for it. Your computer’s hosts file maps localhost to 127.0.0.1, so the two mean the same thing.
  • ::1 is the IPv6 version.
  • Strictly, everything from 127.0.0.0 to 127.255.255.255 (written 127.0.0.0/8, see CIDR and subnets) is loopback. 127.0.0.1 is the one everyone uses.

Open a terminal (Terminal on a Mac, PowerShell on Windows) and run:

Terminal window
ping 127.0.0.1

The replies come back in well under a millisecond, because nothing leaves the machine. Press Ctrl+C to stop (Windows stops by itself after four).

  • It isn’t an indicator. 127.0.0.1 in a sample or a log is not a useful IOC on its own. Don’t block or hunt it.
  • Malware uses it on purpose. A config pointing at 127.0.0.1 may be a placeholder, a switched-off server, or a test the author forgot to remove. Some malware also talks between its own parts over loopback.
  • Blocklists use it. DNS blocklists and sinkholes sometimes answer a bad domain with 127.0.0.1 or 0.0.0.0, so the connection goes nowhere. Seeing that in a lookup usually means someone already flagged the domain (see DNS).
  • Your lab uses it. Tools in your lab often listen on localhost so only that machine can reach them.

Public and private addresses: why the address on your laptop isn’t the one websites see.

One Reverse Look

"A little learning is a dangerous thing." ~ A. Pope

One Reverse Look · Made with ❤ · Your friendly knowledge seeker