8

I have two wireless dongles attached to my Pi B+:

  • wlan0/RALINK is for network connectivity
  • wlan1/TPLINK is for monitor mode traffic analysis

The problem is, they change unpredictably (even without something obvious like changing which USB ports they're plugged into). Sometimes wlan1 is the TPLINK dongle, sometimes it's the RALINK dongle. This messes up my scripts, which assume wlan1 will be the TPLINK dongle.

How can I force the RALINK dongle to always be wlan0, and the TPLINK dongle to always be wlan1? Is there a way to bind a USB ID or MAC address to a certain interface? How is the network interface for each device chosen - by the order of USB ports all the devices are plugged into?

  • 2
    Post the content of your /etc/network/interfaces One suggestion is that you could create a 2nd wpa_supplicant for wlan1 You are probably using /etc/wpa_supplicant/wpa_supplicant.conf for both. – Milliways Nov 6 '14 at 1:00
5

Credit to pogo-pope on Reddit for the answer:

edit /lib/udev/rules.d/75-persistent-net-generator.rules

replace: KERNEL!="ath*|msh*|ra*|sta*|ctc*|lcs*|hsi*", \

with: KERNEL!="eth*[0-9]|ath*|wlan*[0-9]|msh*|ra*|sta*|ctc*|lcs*|hsi*", \

Shutdown your Pi, remove the USB dongle you intend to call wlan1. Boot up and plug the wlan1 dongle back in.

/etc/udev/rules.d/70-persistent-net.rules should be created with definitions for persistent rules for wlan0 and wlan1. If you find the interfaces are swapped you should be able to edit the rules in the file to your liking.

Of course if /etc/udev/rules.d/70-persistent-net.rules already exists you might want to edit that directly or delete it.

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.