8

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.

3
  • 4
    Sanity check: Do you know that things may break if you do that?
    – Hennes
    Dec 20, 2012 at 9:15
  • 4
    You need a loopback networking interface. It handles services on your local machine. Why do you wish to remove this facility?
    – fpmurphy
    Dec 20, 2012 at 9:19
  • I know I'm not supposed to. Just wondering if it's possible.
    – lang2
    Dec 20, 2012 at 13:04

2 Answers 2

6

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 network 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.

5

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.

3
  • 1
    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, 2012 at 14:12
  • 3
    You might remove it from /usr/src/linux/drivers/net/loopback.c
    – Hennes
    Dec 20, 2012 at 14:23
  • 1
    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, 2013 at 2:23

You must log in to answer this question.

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