I am sorry if this is a silly question, but I am developing an application that should connect to itself over sockets, but to make it secure it should only be reachable from local device. I believe I am looking for 127.0.0.1
, but I am not sure. Could someone confirm if this IP address is unreachable from any outside IP address?
1 Answer
Any address in the 127.0.0.0/8
block can never appear anywhere on any network, nor can any address in that block be used as a source or destination address for packets outside the host.
The goes back at least as far as RFC 990, ASSIGNED NUMBERS:
The class A network number 127 is assigned the "loopback" function, that is, a datagram sent by a higher level protocol to a network 127 address should loop back inside the host. No datagram "sent" to a network 127 address should ever appear on any network anywhere.
RFC 1122, Requirements for Internet Hosts -- Communication Layers:
(g) { 127, }
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].
ifconfig
oripconfig
to get your network IP and see if that address can be reached by another computer on the network.