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?
- 829,060
- 7,516
2 Answers
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:
- Good detailed explanation of /etc/network/interfaces syntax?;
- Re: Netcfg and allow-hotplug vs auto;
- Howto Set Up Multiple Network Schemes on a Linux Laptop PCMCIA, Cardbus, USB ;
- Debian networking. Basic sintax of /etc/networ/interfaces;
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.
- 13
- 199
-
4"...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
autowhich will force the interface up regardless whether the cable is connected etc? – Martin Mar 27 '15 at 16:29allow-hotplugbecause i wanted to ensure that my firewall would negotiate link AFTER the core switch totally booted and applied it's confiurations. In general cases,autoshould be enough. – Mar 27 '15 at 16:31auto! I've lost networking with anohup service networking restartbefore withallow-hotplug. – Will Jan 13 '16 at 20:39allow-hotplugwill see it and blink.autowill maybe not? – Timo May 19 '21 at 15:37