0

I've got multiple data-gathering Rpi3s and they all connect to a router just for them, which is a subnet of my main network. One Rpi is master and communicates with the others to gather all their data by using scp. They each have a USB memory stick and a single USB WiFi adapter.

It has been fairly straight-forward setting them up using wpa-supplicant, the GUI icon. They all have WLAN0 shut off.

Except for one of the computers. It has decided to swap WLAN0 with WLAN1. I can't figure out how or why. It is one of the longer-range ones, with a better antenna on the USB WiFi dongle to work at a distance.

When I RDP into it using the WLAN0 address, iwconfig shows I am on the right router, authenticated. ifconfig says that I am coming in on WLAN0's address. I can't see WLAN1 from my workstation nor can it log into the xNet Access Point.

When I disconnect the antenna from the USB adapter I lose the connection. If I tell it to down WLAN0 I have to bring it inside to my HDMI monitor, mouse and keyboard to turn it back on.

The GUI and ifconfig agree that it thinks I am coming in on WLAN0.

It isn't stopping me from using it, now that I get the picture.

But if there is a way to unconfuse it, I'd like to know about it.

If not, I'll just leave it as it is rather than start over or by cloning one of the others. I'd lose data if I did that.

Any ideas?

SDsolar
  • 2,208
  • 8
  • 24
  • 42
  • Do you have the file */etc/udev/rules.d/70-persistent-net.rules* on the misbehaving RPi? If so, look in there to see if udev has locked a name to the wrong MAC address. I use a customized version of that file to name one of my wifi adapters "mom" to be used as an AP if connected. **SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="80:1f:02:86:f1:fc", KERNEL=="wlan*", NAME="mom0"** See */usr/share/doc/udev/README.Debian* for more details. – bobstro Mar 22 '17 at 02:01
  • Under /etc/udev/rules.d there is one file called 99-com.rules - and it has no SUBSYSTEM=="net" section. Just "input" and "i2c-dev" and "bcm-gpiomem" and "gpio then it goes to KERNEL=="ttyAMA[01}" and KERNEL="ttyS0" ---- I think I see what you are getting at, but am not proficient enough to handle this. – SDsolar Mar 22 '17 at 06:18
  • Dead end then. On debian systems, this is how I've resolved the problem. I'm not sure where raspbian is storing that information to make it persistent now. I suppose you could try creating the file */etc/udev/rules.d/70-persistent-net.rules*, replacing the MAC address and desired interface name in my example. – bobstro Mar 22 '17 at 13:58
  • I see a similar question with an answer: https://raspberrypi.stackexchange.com/questions/67499/raspbian-is-loading-the-wrong-modules-for-wlan0-and-wlan1 - I did it without using either blacklist or MAC addresses. – SDsolar May 25 '17 at 22:29

1 Answers1

3

Have a look at this.

To summarise and prevent link rot:

You need to make a custom udev rule which will do what you want. Raspbian by default doesn't create persistent udev rules for wifi devices.

The author of the linked post suggests using a different name series which doesn't conflict with the defaults, and uses wap0.

Create a new file /etc/udev/rules.d/70-my_network_interfaces.rules:

# Built-in wifi interface used in hostapd - identify device by MAC address
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="b8:27:eb:01:02:03", NAME="wap0"

...

nickcrabtree
  • 438
  • 4
  • 13