What is the loopback address of your network interface?

Posted: March 22, 2015. At: 1:20 PM. This was 3 years ago. Post ID: 8110
Page permalink: http://securitronlinux.com/bejiitaswrath/what-is-the-loopback-address-of-your-network-interface/

The loopback address of the network interface, usually 127.0.0.1, is the address used by the operating system to access the network interface itself.

This is represented in IPv6 as 0:0:0:0:0:0:0:1:/128 or ::1/128 when compressed. This gives the computer user a way to ping a network interface and verify that it is actually working. The ping6 command on Linux is used to ping the IPv6 loopback address.

ubuntu ~ $ ping6 ::1
PING ::1(::1) 56 data bytes
64 bytes from ::1: icmp_seq=1 ttl=64 time=0.015 ms
64 bytes from ::1: icmp_seq=2 ttl=64 time=0.025 ms
64 bytes from ::1: icmp_seq=3 ttl=64 time=0.029 ms
64 bytes from ::1: icmp_seq=4 ttl=64 time=0.029 ms
64 bytes from ::1: icmp_seq=5 ttl=64 time=0.030 ms
^C
--- ::1 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 3998ms
rtt min/avg/max/mdev = 0.015/0.025/0.030/0.007 ms

In this example, I am pinging the loopback IP to test connectivity. This IP address is given a 255.0.0.0 subnet mask and allows basic networking without connecting a network cable.

C:\Users\jason>ping 127.0.0.1
 
Pinging 127.0.0.1 with 32 bytes of data:
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
 
Ping statistics for 127.0.0.1:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

One use of this interface is connecting to a HTTP server running on the local machine by accessing the address http://127.0.0.1 in a web browser. This will bring up the HTML page served out by the Apache LAMP server. There are other IP addresses that are automatically assigned. These are Zeroconf addresses. These are in the range of 169.254.0.0 to 169.254.255.255. These are assigned when there is no DHCP server or static IP addresses assigned to networked computers on a LAN.

Here is example output of the ifconfig command, I am getting information about the loopback address on an Ubuntu server machine.

ubuntu ~ $ ifconfig lo
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:38214 errors:0 dropped:0 overruns:0 frame:0
          TX packets:38214 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:11412622 (11.4 MB)  TX bytes:11412622 (11.4 MB)

This is the normal configuration for the loopback address on an Ubuntu machine.

ubuntu ~ $ cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

The lo interface is configured with an automatically assigned IP address even though it is only allowed the 127.0.0.1 IP address. But this is the normal configuration for a loopback address.

No comments have been made. Use this form to start the conversation :)

Leave a Reply