0

Simple node server started like so:

server.listen(8080, '127.0.0.10');

This ip address does not exist anywhere in ifconfig:

sudo ifconfig | grep 127.0.0.10 # No matches

I can connect to 127.0.0.10 and reach node, but not any other loopback IP:

curl -sS http://127.0.0.10:8080/ # Works
curl -sS http://127.0.0.1:8080/ # curl: (7) couldn't connect to host

I can ping any loopback address (eg 127.0.12.34) and get a response.

What's going on here, and most importantly, is it safe to use this addresses in production without first creating a new loopback adapter like lo:1?

chmac
  • 1,017
  • 1
  • 8
  • 16
  • This is normal for Linux it's just being helpful. Somewhere we have a similar question that this is a duplicate of but I can't find it right now. – user9517 Apr 10 '14 at 12:27
  • Makes me feel better, I tried to find the answer with a multitude of searches before posting. :-) – chmac Apr 11 '14 at 10:59

1 Answers1

1

Loopback is "127.0.0.1/8" - it responds to everything on the 127/8 network. You can connect only on 127.0.0.10 because that is the only loopback IP that the service is listening on.

John
  • 9,070
  • 1
  • 29
  • 34
  • Gotcha. This is only true for 127/8 addresses, or can I also bind to arbitrary addresses locally and use them? Production safe? – chmac Apr 11 '14 at 11:02