0

Hi I have a app that I am working on.

I have the DNS entry me.myappdomain.com that has dns entry points to 127.0.0.1

When my app starts up, it talks locally to a server I have on each device. I have been asked to use a rout-able IP address but I am not sure that this is even possible.

My question is, Why is 127.0.0.1 not considered a routable IP address?

Thanks

Dai Bok
  • 143
  • 7

1 Answers1

2

The IPv4 address range 127.0.0.0/8 is reserved for host loopback. This address should never appear anywhere on any network. Traffic sent to any address in that range will immediately be looped back inside the host.

See RFC 1122, Requirements for Internet Hosts -- Communication Layers, Section 3.2.1.3:

(g) { 127, <any> }

Internal host loopback address. Addresses of this form MUST NOT appear outside a host.

Also RFC 3330, Special-Use IPv4 Addresses

127.0.0.0/8 - This block is assigned for use as the Internet host loopback address. A datagram sent by a higher level protocol to an address anywhere within this block should loop back inside the host. This is ordinarily implemented using only 127.0.0.1/32 for loopback, but no addresses within this block should ever appear on any network anywhere [RFC1700, page 5].

Ron Maupin
  • 3,158
  • 1
  • 11
  • 16
  • what if that is the purpose of the application. Only to talk internally? – Dai Bok Mar 20 '17 at 16:33
  • It is perfectly acceptable to use addresses in that range for communications that will _never_ leave the host, e.g. testing. It may be a poor idea to use it in production if the application may be used on a network in the future. – Ron Maupin Mar 20 '17 at 16:34
  • Could you elaborate ron? What would you anticipate happening on a network? – Dai Bok Mar 20 '17 at 20:08
  • You can't get anything sent to an address in that block to leave the host, and any router seeing an address in that range on the network is supposed to drop the packets that have such an address. Addresses in that block simply cannot be used on a network. – Ron Maupin Mar 20 '17 at 20:13
  • Thanks for your explanation. Its clearer now. I guess if you wanted to communicate with localhost, you would need another method – Dai Bok Mar 20 '17 at 21:13
  • 1
    No, if you want to communicate with localhost then 127.0.0.1 or ::1 is exactly what you'd use – Sander Steffann Mar 20 '17 at 21:27