# Wifi not working - FreeBSD11.1



## Ranga (Apr 22, 2018)

Hi all,

I am new to FreeBSD.  I have tried a lot to enable my wifi but no success.

Below is my /etc/wpa_supplicant.conf:


```
network={
       ssid="myssid"
       psk="mypsk"
}
```

/etc/rc.conf is:


```
hostname="host"
ifconfig_ath0="DHCP"
ifconfig_alc0_ipv6="inet6 accept_rtadv"
sshd_enable="YES"
dumpdev="AUTO"
wlans_ath0="wlan0"
ifconfig_wlan0="WPA SYNCDHCP"
```

But when I run `service netif restart` it says:


```
wlan0: no link...... giving up
```


----------



## shepper (Apr 22, 2018)

> ifconfig_ath0="DHCP"


There is no need to request an IP address for ath0
The handbook describes that some encryptation modules need to be loaded - encryption will not occur without the tkip/ccmp modules.  Note some older hardware only support one encryption algorithm.

DHCP does need to solicit an IP address for wlan0.

```
wlans_ath0="wlan0"
ifconfig_wlan0="WPA SYNCDHCP"
```

See section 30.3 in the handbook about the modules, Identifying the correct device and the correct /etc/rc.conf syntax
https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/network-wireless.html


----------



## Deleted member 48958 (Apr 22, 2018)

You need to remove these lines 
	
	



```
ifconfig_ath0="DHCP"
ifconfig_alc0_ipv6="inet6 accept_rtadv"
```
only these lines should exist in your /etc/rc.conf: 
	
	



```
wlans_ath0="wlan0"
ifconfig_wlan0="WPA DHCP"
```
 Then run `# service netif restart`.


----------



## Sensucht94 (Apr 22, 2018)

also, the wpa_supplicant.conf may require some addidion if the network isn't actually a typical WPA Personal one. In my experience modern NAT routers for optical fiber connection often provide WPA2, while Universities and offices  often offer some kind of WPA-EAP, potentially hidden; on the plus side some public networks still rely on Open/Shared-key WEP. The "`ifconfig $interface up list scan`" output can provide useful info about the kind of network to connect to. wpa_supplicant.conf(5) provides all the required info


----------



## Ranga (Apr 22, 2018)

ILUXA Sensucht94  Thanks for your help.

However, still no luck. exactly the same thing happening.  When i do ifconfig wlan0 scan, it does show my wifi SSID.   And I can connect my phone & windows laptop to my wifi without any issues

I also tried by command line:

#ifconfig wlan0 ssid myssid wepkey mykey deftxkey 1 up

#ifconfig wlan0 (below are some lines from output of this command)

status: no carrier
ssid myssid channel 3 (2422 MHz 11g)
regdomain 101 indoor ecm authmode OPEN privacy OFF deftxkey 1
wepkey 1:104-bit txpower 20 bmiss 7 scanvalid 60 protmode CTS wme burst bintval 0
groups: wlan


----------



## Sensucht94 (Apr 22, 2018)

Usually, if the network interface (wlan0) for the device node (ath0) has been configured properly, the problem lays in the network configuration (e.g. rc.conf, wpa_supplicant.conf, resolv.conf). Is it a WEP network you're trying to connect to then?


----------



## Minbari (Apr 22, 2018)

If you don't manage to solve the problem why don't you use a graphical tool like net-mgmt/networkmgr till you learn the "manual way"; plus is more handy to use a graphical tool on a notebook if you travel a lot and use free wifi spots.


----------



## scottro (Apr 22, 2018)

Looking at man ath it indicates that you may need to load modules in your /boot/loader.conf


```
if_ath_load="YES"
if_ath_pci_load="YES"
```

I have my own little quickstart to wireless in FreeBSD. 
http://srobb.net/fbsdquickwireless.html

By the way you do mention using wepkey in your command line, if you're using wpa or wpa2 you wouldn't want the wepkey line. I don't see in the ifconfig man page, a way to ad the wpa key at command line in FreeBSD, though there may be one I don't know.  (In OpenBSD you can).  But usually, as has been said, you will configure an /etc/wpa_supplicant.conf file and use that.


----------



## Deleted member 48958 (Apr 22, 2018)

Minbari said:


> If you don't manage to solve the problem why don't you use a graphical tool like net-mgmt/networkmgr till you learn the "manual way"; plus is more handy to use a graphical tool on a notebook if you travel a lot and use free wifi spots.



Yes, it's a nice tool, originated from GhostBSD,
Ranga, try to load kernel modules, as written above,
add _if_ath_load="YES"_ and _if_ath_pci_load="YES"_
to /boot/loader.conf, then execute `# kldload if_ath`
and `# kldload if_ath_pci` to load modules instantly.
Then install net-mgmt/networkmgr and configure it:


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
> 
> ...



After installation and configuration, remove all ifconfig related lines from /etc/rc.conf,
then launch networkmgr, it should configure your connection automatically.


----------



## Sensucht94 (Apr 22, 2018)

scottro said:


> Looking at man ath it indicates that you may need to load modules in your /boot/loader.conf


but if devd(8) correctly created an ath0 node, shouldn't ath(4) and its dependencies (including ath_hal(4),AR415 descriptors support and ath_pci(4)) have been loaded already? I'm quite sure ath and related are built-in in GENERIC by default, thus they do not need to to be loaded as modules. The proof is that they should not figure in `kldstat` output, even if attempted to be loaded with `kldload`

`grep ath /usr/src/sys/amd64/conf/GENERIC`


```
device          ath                        # Atheros NICs                           
device          ath_pci                    # Atheros pci/cardbus glue
device          ath_hal                    # pci/cardbus chip support
device          ath_rate_sample            # SampleRate tx rate control for ath
```

Those are all uncommented


----------



## Deleted member 48958 (Apr 22, 2018)

Yes, probably that information is outdated,
`# kldload if_ath.ko`:


> interface if_ath.1 already present in the KLD 'kernel'!


----------



## Ranga (Apr 23, 2018)

Thanks for the tip on GUI interface. I installed gnome.  Then wifimgr which is GUI for wifi connections.  Now my 'ifconfig wlan0' is as below:


    media: IEEE 802.11 Wireless Ethernet MCS mode 11ng
    status: associated
    ssid myssid  channel 1 (2412 MHz 11g ht/20) bssid d4:04:cd:cf:fb:b0
    regdomain 101 indoor ecm authmode WPA2/802.11i privacy ON
    deftxkey UNDEF AES-CCM 2:128-bit txpower 20 bmiss 7 scanvalid 60
    protmode CTS ampdulimit 64k ampdudensity 16 shortgi -stbctx stbcrx wme
    burst roaming MANUAL
    groups: wlan 

But still internet doesnt work.  I tried ping and also surfing on browser.

Thanks for your time and support all of you.


----------



## Ranga (Apr 23, 2018)

please ignore my last post.  Everything is working fine now.  I forgot to reboot my computer thats all

you guys are awesome. thanks so much.  Hoping to learn freebsd in coming days.  i have started reading the handbook.


----------

