Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know it is possible to bring down lo interface by doing ifconfig lo down. But is it possible to configure the kernel that the lo interface will simply not be available? Please note that I don't want to remove kernel source code or disable the entire tcp/ip stack.

Note that this is entirely a technicality question. I know one needs the interface and a lot of bad things will happen to my machine. But I'd still like to know if it's possible at all.

share|improve this question
Sanity check: Do you know that things may break if you do that? – Hennes Dec 20 '12 at 9:15
You need a loopback networking interface. It handles services on your local machine. Why do you wish to remove this facility? – fpmurphy1 Dec 20 '12 at 9:19
I know I'm not supposed to. Just wondering if it's possible. – lang2 Dec 20 '12 at 13:04
up vote 1 down vote accepted

Yes, it is possible, if:

  • You recompile Linux without network support. (none at all)
  • You edit the kernel source.

Just removing it from a configuration appears less trivial then expected. Removing it from /usr/src/linux/drivers/net/Makefile (line 68 in the 3.2.29 kernel) is a good start, but is not enough for succesful compilation. And /usr/src/linux/net/core/dev.c (lines 6606 till 6614) indicate that the loopback device is expected to always exist if the netwokr part is selected. (as indicated by this comment in the code):

/* The loopback device is special if any other network devices
 * is present in a network namespace the loopback device must
 * be present. Since we now dynamically allocate and free the
 * loopback device ensure this invariant is maintained by
 * keeping the loopback device as the first device on the
 * list of network devices.  Ensuring the loopback devices
 * is the first device that appears and the last network device
 * that disappears.

So: Yes, it is possible. But not entirely trivial.

share|improve this answer

Of course it's possible. Linux is open source; with enough hacking in the build system and/or source code, you can do anything. You could definitely compile Linux without a TCP/IP stack at all; in that case, you wouldn't be able to have any network interfaces because the kernel would have no concept of "network".

This isn't normally something you can disable from the GUI or from the command line on a standard Linux distribution such as Ubuntu or Debian or Fedora, because the loopback interface is hard-wired into the particular kernel build they ship; but that doesn't mean that you can't recompile a kernel with it removed.

Also, if you don't have any particular need to do this, and are "just wondering", I would advise that you not ask this sort of question -- the reason being, we try to discourage trivial or "just for fun" questions on SU. Please only ask a question if you have a real problem.

share|improve this answer
thanks. And this is not for fun. So to remove lo, one has to remove it from the code or disable tcp/ip stack completely? – lang2 Dec 20 '12 at 14:12
You might remove it from /usr/src/linux/drivers/net/loopback.c – Hennes Dec 20 '12 at 14:23
Many, many packages use TCP/IP networking behind your back, even to communicate on the same machine without any outside contact. Nothing will work, – vonbrand Feb 23 '13 at 2:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .