I am working with a pcengines apu2c4 board with debian 8.4 installed.Obviously when you insert a wifi dongle new to the machine it is given wlan0, wlan1, wlan2 etc... Is there a way of making all future wifi devices use the same settings in /etc/network/interfaces instead of making a new section in interfaces every time a new adapter is plugged in?


You probably have to have an entry in /etc/udev/rules/70-persistent-net.rules that allocates the same wlan0 name to any wlan device that it detects.

e.g. On one of my systems, I have a TP-Link TL-WN721N that has the following rule:

# USB device 0x:0x (ath9k_htc) TP-Link TL-WN721N
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="xx:xx:xx:xx:xx:xx", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"

If I wanted to turn that into a generic rule that matched any WLAN device, regardless of the MAC address etc, I'd comment out or delete that rule and replace it with something like this:

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", KERNEL=="wlan*", NAME="wlan0"

Note: This WILL cause you problems if you later find you need two wlan devices installed or otherwise need to distinguish between different wlan devices.

I just re-read your question. It seems like you might already have two wlan devices in the machine. I'm not sure if what you want is possible in that situation unless one of the devices is always the same (and has its own udev rule that comes before the generic rule) while the second device varies.

One possible method is to run something like sed -i -e '/wlan/d' /etc/udev/rules.d/70-persistent-net.rules on every reboot or from a root shell (and remember to make udev reload its config) before you swap the wlan usb adaptors. I know this works with eternet devices because I have to do something very similar whenever I replace a machine's motherboard or PCI-e ethernet card, or clone a system to new hardware.

Also Note: this works with a sysvinit debian system. I have no idea if it works the same on a systemd machine - the only systemd machine I have doesn't have a wlan interface, only ethernet. and I really don't feel like messing with it's network config right now, it was hard enough getting systemd to do what I wanted when I replaced its NIC (by replacing its motherboard) a few months ago.


If you want to share the same IP config/network between several interfaces configure bridging.

In Debian it should be something similar to this:

allow-hotplug wlan0
    iface wlan0 inet manual

allow-hotplug wlan1
    iface wlan1 inet manual

auto br0
iface br0 inet static
bridge_ports wlan0 wlan1

You also need to load the bonding kernel module.

Add to /etc/modules


Please read: Network Card Bonding and Bridging On CentOS and Debian

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.