22

According to Debian Network setup document allow-hotplug <interface_name> stanza in /etc/network/interfaces file starts an interface when the kernel detects a hotplug event from the interface. What is this hotplug event?

19

allow-hotplug <interface>, is used the same way auto is by most people. However, the hotplug event is something that involves kernel/udev detection against the hardware, that could be a cable being connected to the port, or a USB-to-Ethernet dongle that will be up and running whenever you plug on USB, or either a PCMCIA wireless card being connected to the slot.

My personal opinion: I also think that allow-hotplug could have more documented examples to make this thing easier to understand. As pointed out by other U&L members and Debian lists, those two options create the "chicken and egg problem" when there are no cables connected or when an event is created:

References:

  • 1
    I see. However, in case of servers, the best practice is probably to use auto which will force the interface up regardless whether the cable is connected etc? – Martin Mar 27 '15 at 16:29
  • 1
    Depens. I had a case where i have to set to allow-hotplug because i wanted to ensure that my firewall would negotiate link AFTER the core switch totally booted and applied it's confiurations. In general cases, auto should be enough. – user34720 Mar 27 '15 at 16:31
  • 4
    I would also point out that, in most cases, cloud/EC2/VPS/VMs should use auto! I've lost networking with a nohup service networking restart before with allow-hotplug. – Will Jan 13 '16 at 20:39
  • Good catch. I found some of the same issues you and the other answer by Sprinterfreak pointed out at Debian Lists. Edited my answer with this valuable information – user34720 Feb 10 '17 at 13:07
  • Incorrect. "If I power up a system with a built-in ethernet interface, but with no ethernet cable plugged into it, does plugging in an ethernet cable also generate a hotplug event that is noticed by allow-hotplug? Unfortunately no". / linuxquestions.org/questions/linux-kernel-70/… / unix.stackexchange.com/a/520633/29483 – sourcejedi 2 days ago
8

There is a general important thing to remember:

If you configured a plugable device as auto, it will prevent the entire system from booting if it doesn't exist at the moment! Whether an allow-hotplug configured device IS NOT set to up after services networking restart automatically. That's totally confusing. In both cases I've lost entire systems. If you have to restart neworking being connected to a hotplug-device you MUST manually ensure to ifup <interface> after restart like this

services networking restart; ifup wlan0

at once. Otherwise you are screwed.

  • 3
    "...device as auto, it will prevent the entire system from booting if it doesn't exist at the moment", I just tried this on virtual machine and it booted alright (without network of course, since I disabled in VM software all network adapters), care to explain more? – Kyslik Feb 26 '17 at 12:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.