I tried implementing the systemd.link approach. It did not work for me. I have a raspberry pi 3b+ rev 1.3 with raspberry pi o/s (Debian GNU/Linux 12 (Bookworm)) and a Realtek external wifi. Sometimes the internal is wlan0 and the external is wlan1, other times they are flipped. I need the internal to consistently be wlan1 and the external wlan0. Also, when the external is wlan0 and I put the external in monitor mode, the internal is not connected to my local wifi. I have to manually connect it.
I used ifconfig to determine the mac address of each of the two devices. The first file I created was 10-managed.link for the internal with Name=wlan1 and the second file is 11-monitor.link with Name=wlan0
I did notice that there are two link files: /etc/systemd/network/73-usb-net-by-mac.link -> /dev/null and /etc/systemd/network/99-default.link -> /dev/null. Do I need to do anything with these?
When a systemd unit is symlinked to /dev/null, it's impossible to activate them.
If your setup works without these units activated, you don't need to edit these symlinks.
I came up with an alternate approach. From within my application, I check the mac address of wlan0 and wlan1 with "ip -brief link show dev [wlan0 | wlan1]" I expect the internal wifi to begin "b8:27:eb" for Broadcom. If I find a match on wlan0, then wlan1 becomes the monitor; otherwise wlan0 is set as the monitor. It may not be foolproof, but it works for automating the configuration of several units so far.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I tried implementing the systemd.link approach. It did not work for me. I have a raspberry pi 3b+ rev 1.3 with raspberry pi o/s (Debian GNU/Linux 12 (Bookworm)) and a Realtek external wifi. Sometimes the internal is wlan0 and the external is wlan1, other times they are flipped. I need the internal to consistently be wlan1 and the external wlan0. Also, when the external is wlan0 and I put the external in monitor mode, the internal is not connected to my local wifi. I have to manually connect it.
I used ifconfig to determine the mac address of each of the two devices. The first file I created was 10-managed.link for the internal with Name=wlan1 and the second file is 11-monitor.link with Name=wlan0
I did notice that there are two link files: /etc/systemd/network/73-usb-net-by-mac.link -> /dev/null and /etc/systemd/network/99-default.link -> /dev/null. Do I need to do anything with these?
When a systemd unit is symlinked to
/dev/null, it's impossible to activate them.If your setup works without these units activated, you don't need to edit these symlinks.
I came up with an alternate approach. From within my application, I check the mac address of wlan0 and wlan1 with "ip -brief link show dev [wlan0 | wlan1]" I expect the internal wifi to begin "b8:27:eb" for Broadcom. If I find a match on wlan0, then wlan1 becomes the monitor; otherwise wlan0 is set as the monitor. It may not be foolproof, but it works for automating the configuration of several units so far.