Gentoo Archives: gentoo-user

From: William Kenworthy <billk@×××××××××.au>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Choose a wireless access point
Date: Tue, 05 Apr 2022 08:22:38
Message-Id: 249a2822-5476-13b6-5805-be73fdf867d9@iinet.net.au
In Reply to: Re: [gentoo-user] Choose a wireless access point by Michael
1 On 5/4/22 16:05, Michael wrote:
2 > On Tuesday, 5 April 2022 08:46:52 BST Neil Bothwick wrote:
3 >> On Tue, 5 Apr 2022 11:16:10 +0800, William Kenworthy wrote:
4 >>> On 5/4/22 07:09, Michael wrote:
5 >>>> On Monday, 4 April 2022 16:12:53 BST Jack wrote:
6 >>>>> On 4/4/22 01:31, William Kenworthy wrote:
7 >>>>>> Is there a way force openrc and wpa_supplicant to map a particular
8 >>>>>> access point to an interface or fail?
9 >>>>>>
10 >>>>>> I have two AP's (each on a different ssid) to connect to so have two
11 >>>>>> wifi interfaces - unfortunately they are not equal so I want wlan0
12 >>>>>> to connect to only one particular AP, and wlan1 to the other ...
13 >>>>>> reliably! I can manually force it to connect but invariably at the
14 >>>>>> first glitch they both end up connected to the same AP (usually the
15 >>>>>> strongest which is often not what I want :(
16 >>>>>>
17 >>>>>> BillK
18 >>>>> I don't know about wpa-supplicant, but I'm using open-rc and KDE, and
19 >>>>> KDE's systemsettings Network / Connections screen lets you restrict a
20 >>>>> network connection so a specific device. Not sure if this helps you
21 >>>>> any, but it would indicate that what you want is possible.
22 >>>>>
23 >>>>> Jack
24 >>>> Look at the example provided in:
25 >>>>
26 >>>> /usr/share/doc/netifrc-0.7.3/net.example.bz2
27 >>>>
28 >>>> You can set a different ssid for each wireless NIC. The
29 >>>> wpa_supplicant can be set with credentials for the two APs only.
30 >>> Unfortunately, this does not work as I want ...wpa_supplicant's
31 >>> behaviour makes sense in that it provides a fallback if the allocated
32 >>> access point cant connect ... it will pick the next available one
33 >>> (seemingly based on signal strength) if it is in its conf file (and
34 >>> does not care that its another ssid) - so it does not fail. As only
35 >>> one of the two networks has internet access the device often ends up
36 >>> not being able to be connected to (its headless so that's a problem!).
37 >>>
38 >>> I have fallen back to openrc for the main connection and will do the
39 >>> other manually - it would be nice to have everything properly
40 >>> controlled but its not working for me.
41 >> Could you run two instances of wpa_suplicant, each listening on a
42 >> different interface and using a config with only the AP for that
43 >> interface?
44 > As I recall wpa_cli can be launched by specifying a particular interface.
45 > Therefore two instances of wpa_cli launched by a script should be possible.
46 >
47 > However, isn't the purpose of /etc/conf.d/net to specify how individual
48 > interfaces are configured? I still think - but have not tried it - each
49 > wireless NIC can be configured via this file to use a particular access point/
50 > channel and not go scanning for others, while the wpa_supplicant can be left
51 > to deal with the authentication mechanism after each NIC has found its
52 > specified ESSID.
53 >
54 > The section in the netifrc example file which starts as follows, merits
55 > reading:
56 >
57 > ###############################################
58 > # SETTINGS
59 > # Hard code an SSID to an interface - leave this unset if you wish the driver
60 > # to scan for available Access Points . . .
61 >
62 > Something like this ought to work:
63 >
64 > essid_wlan0="foo"
65 >
66 > essid_wlan1="bar"
67
68 Didnt work - what did work was setting up the main network using normal
69 openrc and scripting the other interface after making it
70 config_wlan1="null" in conf.d/net.  I am putting this part of the
71 problem as solved.  Routing is still an issue but once I have a couple
72 of diagnostic packages installed (compiling is slow on a pi!) I will be
73 better able to see whats gone wrong.
74
75 BillK