# FreeBSD 8.0 - Macbook: Trying to connect to wireless



## Koroviev (Apr 15, 2010)

*What Happened*

A few days ago I installed FreeBSD 8from USB to my Macbook (Core Duo, 13").
The first thing I wanted to do was get my GUI back. I'm new to FreeBSD and it's my first time off of mac or windows, so I had some learning to do.
I tried to a make clean install of xorg with ports but it returned many 
	
	



```
No address record
```
 errors.
I realised I hadn't configured network settings and then the fun started.

I ran [cmd=]ifconfig[/cmd] and it found 5 devices:
msk0, ath0, fwe0, fwip0, lo0 *

ath0 was identified as 
	
	



```
media: IEEE 802.11 Wireless Ethernet autoselect
```
 so it was clear which one I needed.

From what I gathered, there are 3 files and two processes involved here:

/boot/loader.conf
/etc/wpa_supplicant.conf
/etc/rc.conf


/etc/rc.d/netif
wpa_supplicant (which is a part of the former too)

I'm certain it's a big simplification, so correct me if I'm wrong here.

*What I Tried*
I configured /boot/loader.conf with the few basic settings, and I'm most sure that this file is okay. The other 2 were more puzzling.
I tried to make a network package in wpa_supplicant.conf.
I found the ssid of the router, but the security wasn't so easy. The routers configuration on security is set to "Auto", with no explanation given. Other options are there, but Auto is selected. Another laptop uses WEP to connect (it's Vista, so I don't know how to get any more info than that), but I never configured it to do it. There's a string labled "wireless key" on the bottom of the router which I entered to set it up a new machine on the network (Windows and Macs, so it was simplified). I never had to choose a security type and only learned about them by installing FreeBSD.

So perhaps WEP is what "Auto" means, but I can't find any other evidence.

wpa_supplicant.conf seemed to never be correctly configured. I always got errors related to it and WPA_supplicant doesn't work. It gave me 
	
	



```
Can't disable/enable WPA in the driver
```
 errors and more once when I enabled -d -d. This was when I was trying some suspect configurations in rc.conf though. Usually it does nothing except hijack the shell and print 
	
	



```
CTRL-SCAN-EVENT-RESULT
```
 every 10 seconds.

I learned how to clone the ath0 device to a wlandev interface (wlan0).
ath0 is associated to it and their connection seems to go smoothly. But the wlan0's connection to the network is the problem. I couldn't create this with rc.conf, I do something wrong and get 
	
	



```
ifconfig: create: bad value
```
 errors whenever it's parsed. I did it via the shell instead.

*What Now?*
I scanned with wlan0 today: 
	
	



```
ifconfig wlan0 list scan
```
It shows my router, even my neighbour's router. It was a relief to finally get some feedback.

So wlan0 is UP and detects the router, but it is always 
	
	



```
status: no carrier
```
. It can't associate with it and I can't figure out why. Running [cmd=]/etc/rc.d/netif start[/cmd] returns almost the same result as ifconfig would. It shows lo0 and wlan0, and sometimes ath0. I still not sure what lo0 is doing.

So; how do I associate with it? We can assume it's WEP security based on how the other laptop is setup. I'll give every relevant output here.

After boot, with a blank rc.conf this is what [cmd=]ifconfig[/cmd] returns:


```
msk0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
	options=11a<TXCSUM,VLAN_MTU,VLAN_HWTAGGING,TSO4>
	ether 00:17:f2:29:89:3b
	media: Ethernet autoselect
ath0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 2290
	ether 00:16:cb:bb:fe:65
	media: IEEE 802.11 Wireless Ethernet autoselect (autoselect)
	status: no carrier
fwe0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
	options=8<VLAN_MTU>
	ether 02:17:f2:60:ad:7e
	ch 1 dma -1
fwip0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
	lladdr 0.17.f2.ff.fe.60.ad.7e.a.2.ff.fe.0.0.0.0
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
	options=3<RXCSUM,TXCSUM>
	inet6 fe80::1%lo0 prefixlen 64 scopeid 0x5 
	inet6 ::1 prefixlen 128 
	inet 127.0.0.1 netmask 0xff000000
```

I run: [cmd=]ifconfig wlan0 create wlandev ath0[/cmd]
It returns:


```
wlan0: bpf attached
wlan0: bpf attached
wlan0: Ethernet address: xx:xx:xx:xx:xx:xx
```

[cmd=]Ifconfig[/cmd] now returns:


```
msk0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
	options=11a<TXCSUM,VLAN_MTU,VLAN_HWTAGGING,TSO4>
	ether 00:17:f2:29:89:3b
	media: Ethernet autoselect
ath0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 2290
	ether 00:16:cb:bb:fe:65
	media: IEEE 802.11 Wireless Ethernet autoselect (autoselect)
	status: no carrier
fwe0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
	options=8<VLAN_MTU>
	ether 02:17:f2:60:ad:7e
	ch 1 dma -1
fwip0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
	lladdr 0.17.f2.ff.fe.60.ad.7e.a.2.ff.fe.0.0.0.0
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
	options=3<RXCSUM,TXCSUM>
	inet6 fe80::1%lo0 prefixlen 64 scopeid 0x5 
	inet6 ::1 prefixlen 128 
	inet 127.0.0.1 netmask 0xff000000 
wlan0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
	ether 00:16:cb:bb:fe:65
	media: IEEE 802.11 Wireless Ethernet autoselect (autoselect)
	status: no carrier
	ssid "" channel 1 (2412 Mhz 11b)
	regdomain 106 indoor ecm authmode OPEN privacy OFF txpower 20 bmiss 7
	scanvalid 60 bgscan bgscanintvl 300 bgscanidle 250 roam:rssi 7
	roam:rate 1 wme burst bintval 0
```


I run:

[cmd=]ifconfig wlan0 up[/cmd]
[cmd=]ifconfig wlan0 scan[/cmd]

It finds my router and displays its details.
I can feed it my routers details now, using: [cmd=]ifconfig wlan0 key value key value[/cmd] ...
They show up in wlan0 when I run [cmd=]ifconfig[/cmd], but it still doesn't associate.

*1.* What details should I feed it, what exactly is needed?
*2.* What, if anything, should I have in /etc/wpa_supplicant.conf (and if that psk is needed, is it most likely the string I mentioned above)?
*3.* If I define the ssid in wpa_supplicant.conf, should I still feed it to wlan0?
*4.* What process should I then use to associate it?
*5.* How should I add these things to rc.conf so it will automatically do this at boot?

A huge thank you in advance for any help you can give, I've spent hours crawling about the shell and I've learned quite a bit from it (I finally got the hang of vi too, from all that editing). But the sooner this is fixed, the better.

*P.S. I was, and still am, wondering where the extra three devices come from (the wireless and wired were all I expected to find).
lo0 is up at each boot and [cmd=]/etc/rc.d/netif[/cmd], I have no idea what it is and can't find it in [cmd=]dmesg[/cmd].

*Resources:*
/etc/loader.conf:

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

/etc/wpa_supplicant.conf (I emptied it of everything unnecessary, because I was just causing errors)


```
network={
ssid="BTVOYAGER2110-1C"
}
```

/etc/rc.conf has no network settings, I commented them out because of errors. There was my attempt to clone ath0 and feed it info, but I did if via the shell instead.

I've included the output of [cmd=]dmesg[/cmd] as an attachment, in case it's useful.

I'd include the boot text (which appears before login) but I don't know how to catch it into a text file. If it's needed and somebody tells me how, I will (actually, even if it's not needed, how can I view it to read?).


----------



## vermaden (Apr 15, 2010)

@Koroviev

You can get wireless connection that way:
http://daemonforums.org/showthread.php?t=3651

Just replace iwn with ath.


----------



## DutchDaemon (Apr 15, 2010)

@Koroviev: drop the fonts, go easy on the size, bold and underline stuff, and use proper posting tags like *[cmd]* and *[file]* in the future; this will make your posts cleaner and more readable to everyone -> Posting and Editing in the FreeBSD Forums


----------



## vermaden (Apr 15, 2010)

@DutchDaemon

Actually his formating was very helpful in reading, nice change from the default first post by new user without any formatting.


----------



## DutchDaemon (Apr 15, 2010)

The layout was fine, but the forum rules and guidelines still apply (and not everybody will be able to render certain fonts and sizes thereof successfully).


----------



## DutchDaemon (Apr 15, 2010)

BTW: lo(4). You will find that lo0 is about the most important device on your system, which is why it gets loaded without any user intervention or configuration (it's in /etc/defaults/rc.conf).


----------



## Koroviev (Apr 15, 2010)

Thank you for the (very quick) replies!
I tried what you posted, but running [CMD=]/etc/rc.d/netif[/CMD] doesn't change. It throws an "[CMD=]ifconfig: create: bad value[/CMD]" error too.
But there may be something else which reveals the solution.

With these settings I ran: [CMD=]wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf -d -d | less[/CMD]
Going through the results I see this:


```
Setting scan request: 5 sec 0 usec
Starting AP scan (broadcast SSID)
Received 0 bytes of scan results (1 BSSes)
Scan results: 1
CTRL-EVENT-SCAN RESULTS
Selecting BSS from priority group 0
Try to find WPA-Enapled AP
0: xx:xx:xx:xx:xx:xx ssid='BTVOYAGER-1C' wpa_ie_len=0 rsn_ie_len=0 caps=0x31
	skip - no WPA/RSN IE
Try to find WPA-Enapled AP
0: xx:xx:xx:xx:xx:xx ssid='BTVOYAGER-1C' wpa_ie_len=0 rsn_ie_len=0 caps=0x31
	skip - non-WPA network not allowed
No suitable AP found.
```

It just repeats and repeats as wpa_supplicant loops in scanning.
So I guess that it looks for a WPA access point, finds the router and drops it because it's not WPA.
Then it looks for a non-WPA access point, finds the router and drops it because WPA_supplicant is configured to connect to WPA networks only.
What can I do here?

PS. Sorry about the formatting, as Vermaden  said, I tried to make things more clear, but I didn't realise that so much markup wasn't allowed. I'll remember and after reading the rules, I hope this post goes by them.


----------

