# WiFi Help



## markbsd (Nov 4, 2013)

I'm afraid I've no idea where to start. I've just installed 9.2 to an old piece of x86 architecture. I know it has WLAN, but that's it.

`pciconf -lv` reveals


```
ath0@pci0:x:xxx:xx:	class=xxxxxx card=xxxxxx chip=xxxxxx rev=0x01 hdr=0x00
    vendor     = 'Atheros Communications Inc.'
    device     = 'AR2413 802.11bg NIC'
    class      = network
    subclass   = ethernet

<snip>

rl0@pci0:xx:xxx:x:	class=xxxxx card=xxxxx chip=xxxxx rev=0x10 hdr=0x00
    vendor     = 'Realtek Semiconductor Co., Ltd.'
    device     = 'RTL-8139/8139C/8139C+'
    class      = network
    subclass   = ethernet
```

I performed `echo "ifconfig_ath0="DHCP WPA"" > /etc/rc.conf` and also ran `make install clean` in /usr/ports/net-mgmt/wifimgr, but when running this app it shows no networks.

Here's my /etc/rc.conf:


```
hostname="freebsd"
#ifconfig_rl0="DHCP"
ifconfig_ath0="DHCP WPA"
```

And `ifconfig` reveals:


```
ath0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 2290
	ether xx:xx:xx:xx:xx:xx
	nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
	media: IEEE 802.11 Wireless Ethernet autoselect (autoselect)
	status: no carrier
```




Any suggestions?


----------



## Juanitou (Nov 4, 2013)

markbsd said:
			
		

> I'm afraid I've no idea where to start.


Iâ€™m a beginner, so I started here: Wireless Networking.

I think you are missing the wlan() part, but I could be wrong. For example, putting `wlans_ath0="wlan0"` in /etc/rc.conf is the equivalent of `# ifconfig wlan0 create wlandev ath0`. Have you tried using the command line to test functionality?

Hope it helps!


----------



## Beeblebrox (Nov 4, 2013)

http://www.freebsd.org/doc/handbook/network-wireless.html

You need to set SSID and several other parameters. If you have a desktop installed, you might have an easier go at it with an app that has GUI. For command-line, you need to use iwconfig(8)()


----------



## SirDice (Nov 4, 2013)

Beeblebrox said:
			
		

> For command-line, you need to use iwconfig(8)()


That's a Linux command, we don't have it. We use ifconfig(8).


----------



## tzoi516 (Nov 4, 2013)

Can't forget wpa_supplicant.conf


----------



## markbsd (Nov 4, 2013)

Okay. Thanks everyone. I think I've made some progress, but still no WiFi.

Steps thus far:

1. created new file /boot/loader.conf with the following lines:

```
if_ath_load="YES"
if_wi_load="YES"
wlan_wep_load="YES"
wlan_ccmp_load="YES"
wlan_tkip_load="YES"
```

2. `reboot`

3. 
	
	



```
root@freebsd:~ # [CMD]ifconfig wlan0 create wlandev ath0[/CMD]
[FILE]ifconfig: wlandev: bad value[/FILE]
```

4. 
	
	



```
root@freebsd:~ # [CMD]ifconfig wlan0 up scan[/CMD]
root@freebsd:~ #
```

5. added the following to /etc/rc.conf


```
##Attempts to configure WLAN
wlans_ath0="wlan0"
ifconfig_wlan0="DHCP WPA"
#ifconfig_ath0="inet xx.0.0.xx netmask 255.255.255.0"
```

6. `ifconfig` reveals:

```
wlan0: flags=8c43<UP,BROADCAST,RUNNING,OACTIVE,SIMPLEX,MULTICAST> metric 0 mtu 1500
	ether xx:xx:xx:xx:xx:xx
	nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
	media: IEEE 802.11 Wireless Ethernet autoselect (autoselect)
	status: no carrier
	ssid "" channel 10 (2457 MHz 11g)
	regdomain 100 indoor ecm authmode WPA1+WPA2/802.11i privacy OFF
	txpower 20 bmiss 7 scanvalid 450 bgscan bgscanintvl 300 bgscanidle 250
	roam:rssi 7 roam:rate 5 protmode CTS wme burst roaming MANUAL
```

7. `pciconf -lv` reveals:

```
ath0@pci0:2:4:0:	class= <snip>
    vendor     = 'Atheros Communications Inc.'
    device     = 'AR2413 802.11bg NIC'
    class      = network
    subclass   = ethernet
```

So, I guess all I've managed to achieve is assigning ath0 to wlan0, which in effect does nothing for me. For some reason `ifconfig wlan0 create wlandev ath0` returns a bad value and `ifconfig wlan0 up scan` returns absolutely nothing!

I'm at a loss. I figure there's no point configuring wpa_supplicant till this is addressed. Any takers? I'd really love to have WiFi up and running on this FreeBSD box. Thanks.


----------



## markbsd (Nov 4, 2013)

I don't get it. `ifconfig wlan0` shows the device is UP. So, `ifconfig wlan0 scan` should return available networks. But it returns nothing. This is really annoying!


```
root@freebsd:~ # [CMD]ifconfig wlan0[/CMD]
wlan0: flags=8c43<UP,BROADCAST,RUNNING,OACTIVE,SIMPLEX,MULTICAST> metric 0 mtu 1500
	ether xx:xx:xx:xx:xx:xx
	inet xxx.xxx.xxx.xxx netmask 0xffffff00 broadcast xxx.xxx.xxx.xxx
	nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
	media: IEEE 802.11 Wireless Ethernet autoselect (autoselect)
	status: no carrier
	ssid "" channel 1 (2412 MHz 11g)
	regdomain 100 indoor ecm authmode OPEN privacy OFF txpower 20 bmiss 7
	scanvalid 60 bgscan bgscanintvl 300 bgscanidle 250 roam:rssi 7
	roam:rate 5 protmode CTS wme burst bintval 0
```


----------



## Juanitou (Nov 4, 2013)

Just to be sure: aht0 is there when you use `ifconfig`?


----------



## markbsd (Nov 4, 2013)

Yes.


```
root@freebsd:~ # [CMD]ifconfig[/CMD]
ath0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 2290
	ether xx:xx:xx:xx:xx:xx
	nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
	media: IEEE 802.11 Wireless Ethernet autoselect (autoselect)
	status: no carrier
rl0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	options=2008<VLAN_MTU,WOL_MAGIC>
	ether xx:xx:xx:xx:xx:xx
	inet xxx.xx.xx.xxx netmask 0xffffff00 broadcast xx.xx.xx.xx
	nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
	media: Ethernet autoselect (100baseTX <full-duplex>)
	status: active
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
	options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
	inet6 ::1 prefixlen 128 
	inet6 fe80::1%lo0 prefixlen 64 scopeid 0x6 
	inet 127.0.0.1 netmask 0xff000000 
	nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
wlan0: flags=8c02<BROADCAST,OACTIVE,SIMPLEX,MULTICAST> metric 0 mtu 1500
	ether xx:xx:xx:xx:xx:xx
	nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
	media: IEEE 802.11 Wireless Ethernet autoselect (autoselect)
	status: no carrier
```

Don't know what else to do!


----------



## wblock@ (Nov 4, 2013)

IFDISABLED is shown.  Is the wireless disabled on the system with a switch or Fn key combination?


----------



## markbsd (Nov 4, 2013)

It's a Fn key combination, but I don't know if it's serviceable. What do you suggest?


----------



## markbsd (Nov 4, 2013)

Interestingly, in Post 7, you can see that `ipconfig` returned an inet field. It no longer returns this value. Not sure what this suggests? I also can't think what I've specifically changed since then as I've done a whole lot of rebooting with and without certain lines in /etc/rc.conf

This is really frustrating.


----------



## markbsd (Nov 4, 2013)

Ladies and gentlemen, we have lift off!


```
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	ether xx:xx:xx:xx:xx:xx
	inet xxx.xx.xx.xxx netmask 0xffffff00 broadcast xxx.xx.xx.xxx
	nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
	media: IEEE 802.11 Wireless Ethernet OFDM/24Mbps mode 11g
	status: associated
	ssid "MY NETWORK" channel 5 (2421 MHz 11g) bssid xx:xx:xx:xx:xx:xx
	regdomain 100 indoor ecm authmode WPA2/802.11i privacy ON
	deftxkey UNDEF AES-CCM 3:128-bit txpower 20 bmiss 7 scanvalid 450
	bgscan bgscanintvl 300 bgscanidle 250 roam:rssi 7 roam:rate 5
	protmode CTS wme burst roaming MANUAL
```

So, for clarity, and in the hope to help others. This is the process:

Preliminary steps to ascertain PCI data:

a. `pciconf -lv` returns a page and a half of data. Search for your wireless adaptor. For example:


```
ath0@pci0:2:4:0:	class=0x0xxxxx card=0x<snip> chip=0x<snip> rev=0x.. hdr=0x00
    vendor     = 'Atheros Communications Inc.'
    device     = 'AR2413 802.11bg NIC'
    class      = network
    subclass   = ethernet
```

`ifconfig` confirms this:


```
root@freebsd:~ # [CMD]ifconfig[/CMD]
ath0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 2290
	ether xx:xx:xx:xx:xx:xx
	nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
	media: IEEE 802.11 Wireless Ethernet autoselect mode 11g
	status: associated
```

In this example, ath0 is the device. Adjust the following according to your PCI device.


1. Ensure you create /boot/loader.conf and add the following lines:


```
if_ath_load="YES"
if_wi_load="YES"
wlan_wep_load="YES"
wlan_ccmp_load="YES"
wlan_tkip_load="YES"
```

2. `reboot`

3. `nano /etc/rc.conf` and add the following lines:


```
wlans_ath0="wlan0"
ifconfig_wlan0="DHCP"
```

4. `nano /etc/wpa_supplicant.conf`and add the following lines:


```
ctrl_interface=/var/run/wpa_supplicant
	eapol_version=2
	ap_scan=1
	fast_reauth=1

network={
	ssid="YOUR NETWORK SSID"
	psk="YOUR PASSPHRASE"
}
```

5. `reboot`

And FreeBSD will automatically load WLAN upon boot.

Thanks everyone for your help!


----------



## wblock@ (Nov 4, 2013)

markbsd said:
			
		

> 1. Ensure you create /boot/loader.conf and add the following lines:
> 
> 
> ```
> ...



All of these are part of the default GENERIC kernel.  Besides, WEP should not be used any more.


----------



## Beeblebrox (Nov 4, 2013)

> Ensure you create /boot/loader.conf and add the following lines:


After you add items to /boot/loader.conf, you don't need to reboot. You can load the kernel modules and continue to the next step. So, `# kldload if_ath` will load the if_ath kernel module, unless it is already loaded. For a GENERIC kernel, when you try to load that module (because it is already loaded), you will see:

```
kldload: can't load if_ath: File exists
```


----------

