Ubuntu Unleashed 2019 Edition: Covering 18.04, 18.10, 19.04

(singke) #1
127.0.1.1               seymour

#   The following   lines   are desirable   for IPv6    capable hosts
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

The first line defines the special localhost interface and assigns it IP
address 127.0.0.1. You might hear or read about terms such as localhost,
loopback, and dummy interface; all these terms refer to the use of the IP
address 127.0.0.1. The term loopback interface is used because, to Linux
networking drivers, it looks as though the machine is talking to a network that
consists of only one machine; the kernel sends network traffic to and from
itself on the same computer. This is sometimes referred to as a dummy
interface because the interface doesn’t really exist; it is not a real address as
far as the outside world is concerned; it exists only for the local machine, to
trick the kernel into thinking that it and any network-aware programs running
that require a network interface to operate have one available without them
actually being aware that the connection is a connection to the same machine.
It is a dummy not in the sense of stupid or silent, but in the sense that it is a
mockup or substitute for something real.


Each networked Ubuntu machine on a LAN uses this same IP address for its
localhost. If for some reason you discover that an Ubuntu computer does
not have this interface, perhaps because some well-meaning person deleted it
without understanding it was needed, you can use sudo and edit the
/etc/hosts file to add the localhost entry as you saw previously and
then use the ifconfig and route commands using your sudo
permissions to create the interface, like this:


Click here to view code image
matthew@seymour:~$ sudo ip addr add 127.0.0.1/24 dev lo
matthew@seymour:~$ sudo ip route add 127.0.0.1/24 dev lo


These commands create the localhost interface in memory (all interfaces,
such as eth0 or ppp0, are created in memory when using Linux) and then
add the IP address 127.0.0.1 to an internal (in-memory) table so that the Linux
kernel’s networking code can keep track of routes to different addresses.


Use the ip command as shown previously to test the interface.


Checking Connections with ping,

Free download pdf