# Setting up Wi-Fi on FreeBSD 11.1



## 3guesses (Mar 30, 2018)

I have tried to set up wireless networking on my FreeBSD 11.1 install, but it isn't working.  I have identified the wireless adapter (ral0) using "sysctl net.wireless.devices", I have added a section to /etc/wpa_supplicant.conf and added lines to /etc/rc.conf.  When I run "ifconfig", it now lists wlan0 but the status is set to "no carrier" and "ifconfig wlan0 list scan" produces nothing.  Does this mean the driver isn't working for this wi-fi card?


----------



## Sensucht94 (Mar 30, 2018)

chances are high it's /etc/wpa_supplicant.conf related: you should report which kind of connection are you trying to attach to (indicated by the output of `ifconfig wlan0 scan`) and the wpa_supplicant.conf you're using.



3guesses said:


> and "ifconfig wlan0 list scan" produces nothing.



you did bring your interface up first, didn't you? `ifconfig $interface up` is the equivalent of  Linux iproute2's: `ip link set $interface up`

In case this didn't work, and you're used to wpa_supplicant from Linux or other BSDs, where the device used to correctly connecting to the network  of interest with that same configuration, then probably it is something driver-related or due to a /boot/loader.conf issue, or even routing/netif services. Sometimes restarting *routing *and *netif *2-3 times in that order does the trick (if signal is loose, it's not uncommon, at least in my experience, to see "status no carrier" at the first 1-2 attempts, and "status associated" at the following try)


----------



## 3guesses (Mar 30, 2018)

Sensucht94 said:


> chances are high it's /etc/wpa_supplicant.conf related: you should report which kind of connection are you trying to attach to (indicated by the output of `ifconfig wlan0 list scan`) and the wpa_supplicant.conf you're using.
> 
> 
> 
> ...



Thanks for all that.  I'm not particularly au fait with either Linux or FreeBSD and had not needed to do anything low-level to get it working in various Linux distros previously, so I had been using google to try to get the wi-fi connection working.  I hadn't brought the interface up (`ifconfig wlan0 up` produced no output), but after doing so `ifconfig wlan0 list scan` still produces no output at all.  I have tried restarting netif a couple of times (but not routing).  It's a WPA router I'm trying to connect to and the signal should be pretty good as it's only a few feet away and with no other devices connected to it.

EDIT:  Also, ssid is "" from `ifconfig`


----------



## sidetone (Mar 30, 2018)

http://freebsdwiki.net/index.php/Network,_Wireless


----------



## Deleted member 48958 (Mar 30, 2018)

Short way for setting "Intel Corporation Centrino Wireless-N 1000", for example.
Add 

```
wlans_iwn0="wlan0"
ifconfig_wlan0="WPA DHCP"
```
 to /etc/rc.conf and

```
network={
ssid="networkname"
psk="password"
}
```
 to /etc/wpa_supplicant.conf

Then run `# service netif restart`

Just found out that I almost quoting handbook .

Also it is possible to use net-mgmt/networkmgr:


ILUXA said:


> Maybe someone doesn't know,
> there is a nice app in ports tree (originated from GhostBSD) that manages ethernet and wi-fi connections pretty well.
> net-mgmt/networkmgr
> 
> ...


----------



## 3guesses (Mar 31, 2018)

Yes, I had set up wpa_supplicant.conf and rc.conf correctly as above and restarted netif service, but `ifconfig elan0 up scan` just shows no wireless networks, and there are at least a dozen in range that my other computers can see.  FreeBSD seems to be set up to use the wi-fi adapter, but then the adapter doesn't seem to do anything so that's why I'm wondering if it's the driver.  Is there some way I can check?

I've also installed the networkmgr package - can I use it from the command line at all?


----------



## gnath (Mar 31, 2018)

Your 'wlan0' is up and responding to `ifconfig`. So routing need to be restarted. Network manager creates its icon some where in system tray.


----------



## 3guesses (Mar 31, 2018)

gnath said:


> Your 'wlan0' is up and responding to `ifconfig`. So routing need to be restarted. Network manager creates its icon some where in system tray.


I'm not using the GUI, just the command line.  When I run `service routing restart` it deletes everything and then adds everything instantly, but then `ifconfig` still reports "no carrier" for wlan0.  "no carrier" suggests to me that the wi-fi card is not properly activated, hence why I am questioning the driver.


----------



## gnath (Mar 31, 2018)

You have `net.wlan.devices: ral0` , then
	
	



```
wlans_ral0="wlan0"
```


----------



## scottro (Mar 31, 2018)

I always do ifconfig wlan0 up scan, rather than list scan. Not sure if there's any difference. I have my own page on a quickstart to FreeBSD wireless at http://srobb.net/fbsdquickwireless.html.  Also (sorry, haven't read the thread in detail), did you add 
	
	



```
if_ral_load="YES"
```
 to /boot/loader.conf?    According to the man page, that's necessary.

https://www.freebsd.org/cgi/man.cgi?query=ral


----------



## 3guesses (Apr 1, 2018)

Yes,  I have `net.wlan.devices: ral0` and 
	
	



```
wlans_ral0="wlan0"
```
.  I didn't have 
	
	



```
if_ral_load="YES"
```
 in /boot/loader.conf, but adding it doesn't seem to have made much difference.  Does anyone know if there's some sort of wi-fi debugging tool for FreeBSD?


----------



## ldgc (Apr 1, 2018)

3guesses said:


> Does anyone know if there's some sort of wi-fi debugging tool for FreeBSD?


Hello 3guesses 
AFAIK there is wlandebug(8).


----------



## 3guesses (Apr 1, 2018)

pensador_13 said:


> Hello 3guesses
> AFAIK there is wlandebug(8).


Thanks pensador.  I have run `wlandebug +scan` but am having a little trouble interpreting the output (how can I capture it, BTW?).  It seems to scan all of the 802.11g channels but doesn't show anything interesting to my novice eyes.  What should I be looking for?

EDIT: I found a post on Google groups which would seem to suggest I should be seeing "wlan0: received beacon from <MAC address> rssi XX" in the channel scans, but I'm not seeing any such lines.  To me it seems more and more likely that it's a problem with the driver not working properly for the wifi card...


----------



## gnath (Apr 1, 2018)

Probably you have gone through `man ral`.


----------



## Minbari (Apr 1, 2018)

First add  `if_ral_load="YES"` in /boot/loader.conf, then add in /etc/rc.conf:

```
wlans_ral0="wlan0"
ifconfig_wlan0="DHCP"
defaultrouter="192.168.0.1" (it's just an e.g., see your router gateway)
create_args_wlan0="country US regdomain NONE"
```

After that create/edit /etc/wpa_supplicant.conf and add:


```
network={
    ssid="yourssid"
    bssid=8e:79:35:0d:e8:8c (it's just and e.g. add your bssid)
    key_mgmt=WPA-PSK
    proto=RSN
    psk="YourPassWord"
}
```

Finally restart the interface: `service netif start`


----------



## trev (Apr 1, 2018)

Have you checked /var/log/messages for any errors?


----------



## 3guesses (Apr 1, 2018)

gnath: Yes, I have gone through `man ral` but it doesn't provide much in the way of troubleshooting.

Minbari: Yes, I have made all of the configuration changes to the system but the system is not picking up any APs when scanning, so most are irrelevant at this point any way.

trev: What errors should I be looking for?  `grep "ral0" /var/log/messages` just shows 2 lines, one showing the PCI IRQ and the other showing the MAC for the card

It seems to me that the scanning process is not working correctly, which suggests to me that the driver is not fully compatible with the wifi card but I don't know how to confirm this.


----------



## scottro (Apr 1, 2018)

That's my guess as well (that the driver may not be compatible).  By the way, have you set up any firewalls?  Also, if, by chance, all the networks were hiddent networks (unlikely these days, but in the old days Linksys, at least, had it that way by default), you would need the line 
	
	



```
scan_ssid=1
```
 in your /etc/wpa_supplicant.conf file.

Aside from that, I'm not sure why it's not working. One workaround might be the Edimax 7811UN USB to wireless adapter, which, at least in the US is less than $10 dollars on Amazon. 
https://www.amazon.com/Edimax-EW-7811Un-150Mbps-Raspberry-Supports/dp/B003MTTJOY


----------



## ronaldlees (Apr 1, 2018)

One thing I often do is run /security/wpa_supplicant manually.  Something like:

`/usr/sbin/wpa_supplicant -dd -Dbsd -i wlan0 -c /usr/local/etc/wpa_supplicant.conf`

The lack of -B keeps your terminal and the -dd gives you verbose debug output.


----------



## gnath (Apr 1, 2018)

+1 ronaldlees . Also only one interface has to be associated at a time (no wire).


----------

