I've trawled the forums but not found an up to date answer to this. My apologies if I have missed it.
Basic Setup
I have a rPi 2B+ with two wifi adapters connected. wlan0
& wlan1
both show in ifconfig. So far so good.
I've setup dhcpcd, dnsmasq and hostapd the same as I have done on a rPi3B+ I have to make an ad-hoc network. The rPi3 only has the onboard wifi (as the ad-hoc) and ethernet (to home router) and has been working fine for months.
With the rPi2 this also works fine when I put it as a direct replacement for the rPi3, so I am doing something right.
The Problem The difficulty is when I add the second wifi dongle to the rPi2. hostapd seems to be getting duff info as it is trying to setup the network on the wrong dongle...which is already connected to my home wifi. I assume this is a boot sequencing thing.
In the configuration for dhcpcd, dnsmasq and hostapd I have set it to wlan0
. When I plugin the second dongle it takes the place of the first as wlan0
and what was that is now wlan1
.
Easy fix, change the configs to wlan1
but this doesn't sit right with me and it's going to be a PITA when it is eventually running in the application, headless.
The Question Is there a way I can specify/force the above services to use a particular adapter, rather than interface, or tell Stretch to assign an adapter to a particular interface????
The only reference to this issue I can find is on the old version of Stretch where you modify /etc/network/interfaces
, which nowadays breaks dhcpcd5.
tl;dr
How can I know for certain which of the two wifi dongles is assigned to wlan0
and wlan1
such that dnsmasq, dhcpcd and hostapd work correctly.