# What is creating loopback interface? [Solved]

## Bones McCracker

I have two ~x86 machines; both have dhcpcd starting in their default runlevel and no other network-related scripts running (no /etc/init.d/net and no /etc/init.d/network).

Machine A ends up with the eth0 and lo interfaces up (with lo assigned 127.0.0.1).

Machine B end up with only the eth0 interface up (and no loopback interface).

I know how to "fix" this (by using either the net or network script (both config files are completely commented out anyway), or somehow issuing 'ifconfig lo 127.0.0.1' manually).  This is not a problem.  My problem is the mystery.

So I have two questions:

1.  What would be brining up 'lo' on machine A?

Both machines are baselayout 2 with openrc-0.9.3-r1.  One is configured as a desktop (xdm runs in default runlevel), and the other as a server (presently, only xinetd running, in default runlevel).  The other services are all typical and common to both machines (syslog-ng, vixie-cron, sshd, ntpd).

Neither /etc/init.d/net nor /etc/init.d/network is assigned to any runlevel, nor is there any "need net" or "need network" specified as part of anything in /etc/init.d/ (as best I can tell, there are only "uses net", "uses network", "after net", and the like.  'rc-update show' does not show net or network has having been 'hotplugged' or 'needed'.

There is nothing different between the two machines in /etc/rc.conf or /etc/conf.d/udev.

There is nothing different in /etc/udev/udev.conf and /etc/udev/rules.d/ has only the typical stuff in it.

Both machines have /sys/devices/virtual/net/lo/ with all the typical files present, the only difference being and lo has a carrier and operating state on machine A.

Machine B is a "hardened" machine (hardened gentoo kernel, with the hardened-server profile), but I have examined all of the restrictions that introduces and can find nothing that would inhibit normal behavior (and I am able to manually assign 127.0.0.1 to lo and bring it up, assign a route, and so on).

So, why is it happening "automatically" on machine A and not happening on machine B?

2.  Is it important that I add a routing table entry for 'lo'?  I suspect it is, but everything seems to work without it.

The loopback interface appears to work fine without it (e.g., pinging localhost, querying ntpd, works via 127.0.0.1 and takes the same time with eth0 up or down).  So, what is the point of this routing table entry?

----------

## Bones McCracker

I figured it out.

The difference between the two machines above turned out to be this: machine B (the hardened box) had the following directive in its /etc/dhcpcd.conf file (as a security measure):

```
# Discovered interfaces must match space- or comma-delimted shell glob patterns

allowinterfaces eth0
```

When that was commented out, and the machine rebooted, interface 'lo' was magically up and configured with 127.0.0.1.

So I have changed it to:

```
# Discovered interfaces must match space- or comma-delimted shell glob patterns

allowinterfaces lo eth0
```

If anybody understands exactly why/how this happens, I'd be interested to know.

----------

