rc.conf and wpa_supplicant: Which has more influence over choosing an SSID and why?

I got a recent install of FreeBSD 13.0 up and running. The wifi works. On this machine, I had to use the kernel mods for ath. While I was tinkering around with that, for a good while, I could not get the wifi to use my local network. I was in the same room as my access point, so I expected the machine to pick it up right away.

In my /boot/loader.conf I had the kernel mods for ath. It was like:
if_ath_load="YES"
and I think a similar one like if_pci_ath_load. My kldstat looked good. I could see the card and it was getting into ifconfig, so I figured I was good on that.

In my wpa_supplicant, I added in code like:
Code:
network={
    ssid="MY_SSID"
    psk="MY_PASSWORD"
}

In my /etc/rc.conf I had lines like:
Code:
wlans_ath0="wlan0"
ifconfig_wlan0="WPA SYNCDHCP"

I would tinker with that last line ("SYNCHDHCP") eventually cutting it down to "DHCP" to no avail.

I'd try a service netif restart and a service wpa_supplicant restart to no avail. Pretty much every time I would see in ifconfig for the interface a report of ssid="" ... channel SOMETHING_MAY_CHANGE.

When I went back to the handbook, I saw the suggestion of:
ifconfig_wlan0="ssid your_ssid_here DHCP". I used it. It works.

OK, so I wanna know: why? Why should I have to specify the ssid in the rc.conf when I have a valid entry in the wpa_supplicant.conf?
I thought for sure in my previous versions of BSD I would just need to add in the SSID and PSK to the wpa_supplicant.conf.

Why did I have to put the ssid in the rc.conf?
Any suggestions you might offer could be helpful for furthering my understanding.
 
I don't have a definitive answer but I checked my relevant settings in /etc/rc.conf :
Code:
wlans_iwn0="wlan0"
create_args_wlan0="country NL regdomain ETSI"
ifconfig_wlan0="WPA DHCP"
My AP is nearby but so are a lot of others. I can imagine that the regdomain setting might affect how your wifi card gets to establish a connection to your AP that probably has some country specific properties.

If you don't have these settings, What is the correct Regdomain code? might be helpful.

I got a recent install of FreeBSD 13.0 up and running.
[...]
In my wpa_supplicant, I added in code like:
Code:
network={
    ssid="MY_SSID"
    psk="MY_PASSWORD"
}
My SSID is only in /etc/wpa_supplicant.conf, I assume "in my wpa_supplicant" refers to that file.
FreeBSD 13.0 is longer supported, so preferably upgrade to 13.1


edit:
In my /boot/loader.conf I had the kernel mods for ath. It was like:
if_ath_load="YES"
and I think a similar one like if_pci_ath_load.
ath(4) states you need both if_ath_load="YES" and if_ath_pci_load="YES". However, as these are in the FreeBSD base install (GENERIC kernel), these could be omitted. I'd try not specifying those in /boot/loader.conf and see what happens.
 
I don't have a definitive answer but I checked my relevant settings in /etc/rc.conf :
Code:
wlans_iwn0="wlan0"
create_args_wlan0="country NL regdomain ETSI"
ifconfig_wlan0="WPA DHCP"
My AP is nearby but so are a lot of others. I can imagine that the regdomain setting might affect how your wifi card gets to establish a connection to your AP that probably has some country specific properties.

If you don't have these settings, What is the correct Regdomain code? might be helpful.


My SSID is only in /etc/wpa_supplicant.conf, I assume "in my wpa_supplicant" refers to that file.
FreeBSD 13.0 is longer supported, so preferably upgrade to 13.1


edit:

ath(4) states you need both if_ath_load="YES" and if_ath_pci_load="YES". However, as these are in the FreeBSD base install (i.e. GENERIC kernel), these could be omitted. I'd try not specifying those in /boot/loader.conf and see what happens.
This was an excellent answer. Thank you for writing back. I was also curious about the regdomain codes, so that addition was helpful.
I apologize; the version was 13.1-RELEASE. I've done a lot of these over the years, and I made a mistake when I wrote that.
 
ifconfig_wlan0="WPA DHCP" use for when wifi network is encrypted. ifconfig_wlan0="DHCP" when network is open and not encrypted. I spent a day figuring that difference out.

https://forums.ghostbsd.org/viewtopic.php?f=64&t=526 Write up on how to manually configure Wifi for EDIMAX EW-7811un rtl8192cu chip set usb wifi
https://forums.ghostbsd.org/viewtopic.php?f=64&t=570 Write up on how to manually configure wifi for pci chip rtl8188ce


or this Network card configuration by Networkmgr added to /etc/rc.conf file
I needed to set WiFi to channel 6. I think when there are many WiFI access close by, selecting a channel helps the WLAN chip connect to the SSID access point by selecting a channel.
Note that WifiMgr application program looks for keyword "WPA" to determine wireless Wi-Fi lan devices in the /etc/wpa_supplicant.conf.
wlans_rtwn0="wlan0"
ifconfig_wlan0=" WPA channel 6 DHCP"
 
In orther to recover my wifi connection I've needed to set in rc.conf (in the exact order):

Code:
ifconfig_wlan0="ssid MySsid channel WifiChannel  WAP SYNCDHCP"
sysrc create_args_wlan0="country FR regdomain ETSI"

No idea why. Two days ago, everything works fine with:

Code:
ifconfig_wlan0="WAP DHCP"

One day after the update to 13.2 - RELEASE, wifi stop to work... and the only way to recover it was adding the SSID, channel and regdoamin to rc.conf.
Any idea about the reason?

Edit: after a reboot, wifi is down again.
 
In orther to recover my wifi connection I've needed to set in rc.conf (in the exact order):

Code:
ifconfig_wlan0="ssid MySsid channel WifiChannel  WAP SYNCDHCP"
sysrc create_args_wlan0="country FR regdomain ETSI"

No idea why. Two days ago, everything works fine with:

Code:
ifconfig_wlan0="WAP DHCP"

One day after the update to 13.2 - RELEASE, wifi stop to work... and the only way to recover it was adding the SSID, channel and regdoamin to rc.conf.
Any idea about the reason?

Edit: after a reboot, wifi is down again.
Hi,
today after 13.2 update I have the same problem with wifi interface.
in
/etc/rc.conf

before upgrade I used:

create_args_wlan0="country IT regdomain ETSI"

Now, after upgrade this is not working.

To wake up again wlan0, i have to do these steps (no firewall, no vpn)

# ifconfig wlan0 down
# ifconfig wlan0 regdomain ETSI country IT
# ifconfig wlan0 up

EDIT: it was, for my a problem related to resolv.conf and resolvconf.conf configuration.
Everything now is correctly working after 13.2 upgrade.
 
Just for the record, it seems to be a hardware problem, wlan card randomly fails (more and more frequently).
 
Back
Top