# FreeBSD wireless connection failed.



## curses (Dec 22, 2009)

Hello again. I have gotten a little, just a little, more experienced in handling FreeBSD networking since the last time I was here. You'll have to pardon me for not having exact output for you. Since I need wireless to connect to the internet, I have to use linux to get here. I'll save some stuff to my jump drive when I get the chance. I created an interface, wlan0, in my rc.conf file. I also installed desktopbsd-tools, so I have a gui for networks and stuff. I'm using that as a sort of crutch until I figure out ifconfig.
So, I do this: 

```
ifconfig wlan0 up scan
```
then

```
ifconfig wlan0 ssid myqwest1234 wepkey 12345ABC67
```
those aren't the real names or keys, of course, they're just for examples. next I do:

```
dhclient wlan0
```
it tells me that it couldn't find a dhcpoffer and that I am a complete idiot. so I go over to the DesktopBSD network manager to see what that tells me. It scans my interfaces and gives me "myqwest1234", which i then select. I tell it to use dhcp then i give it my wepkey and hit "connect". after a few minutes it tells me that the "connection failed".
So... what's up here? do i need a different dhcp client? if I haven't done this right, what is the right way to do it?  :\
I use KDE 3.5.10 so you know. I can (probably) get you my rc.conf file if you need to see it.


----------



## mickey (Dec 22, 2009)

curses said:
			
		

> ```
> dhclient wlan0
> ```
> it tells me that it couldn't find a dhcpoffer and that I am a complete idiot. so I go over to the DesktopBSD network manager to see what that tells me. It scans my interfaces and gives me "myqwest1234", which i then select. I tell it to use dhcp then i give it my wepkey and hit "connect". after a few minutes it tells me that the "connection failed".
> So... what's up here? do i need a different dhcp client? if I haven't done this right, what is the right way to do it?  :\



If DHCP is unable to successfully receive an offer, chances are high, that something is wrong with your WEP key. You will not get any notice if you are using a wrong key. You will just receive no or garbled data.

So make sure you are using the right WEP key, and the correct method of specifying it. WEP keys can be specified either as ASCII or as HEX. So if your key was for example "12345ABC67" in HEX, but it gets interpreted as ASCII, you will not get a connection.


----------



## bschmidt (Dec 22, 2009)

[Note, this is out of memory, haven't used WEP for quite some years]

When using WEP for encryption, one not only has to supply the key to the driver, but also must tell the driver which key index to use.


```
ifconfig wlan0 ssid myqwest1234 wepkey 12345ABC67 deftxkey 1 up
```

After that, check `# ifconfig wlan0` output for

```
status: associated
```
That indicates a successful connection and you are now able to use `# dhclient wlan0`.


----------



## mickey (Dec 22, 2009)

You may also use wpa_supplicant(8) to connect to your network. This has the advantage of being able to configure multiple wireless networks and have them auto selected.

For this you need to configure /etc/wpa_supplicant.conf with a network block like in this example:

```
# For use in FreeBSD with the wlan module ap_scan must be set to 1.
ap_scan=1

# Shared WEP key connection (no WPA, no IEEE 802.1X)
network={
        ssid="static-wep-test"
        key_mgmt=NONE
        wep_key0="abcde"
        wep_key1=0102030405
        wep_key2="1234567890123"
        wep_tx_keyidx=0
        priority=5
}
```
For a detailed example config see /usr/share/examples/etc/wpa_supplicant.conf.

To enable the use of wpa_supplicant, you need to enable it in your /etc/rc.conf:

```
ifconfig_wlan0="WPA DHCP"
```


----------



## curses (Dec 24, 2009)

Thanks! I got it to work. I don't know why. I did the same thing fifty-kazillion times with no effect until suddenly POOF! well, whatever. I'm writing from the FreeBSD side of my hard drive now. Many thanks and merry Christmas , or Hannukah, or whatever. And a happy New Year!


----------



## epopen (Jun 5, 2010)

I have same problem, And can't solve it.
I used /etc/wpa_supplicant.conf also,
In #ifconfig wlan0, status: associated
But dhcilent always can't get IP, Like

```
# dhclient wlan0
DHCPREQUEST on wlan0 to 255.255.255.255 port 67
DHCPREQUEST on wlan0 to 255.255.255.255 port 67
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 6
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 10
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 11
^C
```
Is can solve?(NIC specifical problem???)
PS1: Wireless card is Intel 5100abgn NIC
PS2: FreeBSD is 8.0 stable and 8.1 prerelease.
PS3: If haven't WEP(no authentication), Work fine.

Thanks you very much.


----------



## bschmidt (Jun 12, 2010)

Can you post the `# ifconfig wlan0` output and also the wpa_supplicant.conf?


----------



## epopen (Jun 16, 2010)

bschmidt said:
			
		

> Can you post the `# ifconfig wlan0` output and also the wpa_supplicant.conf?


Hi
Under is my ifconfig wlan0 output

```
# ifconfig wlan0
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	ether 00:16:ea:be:be:00
	inet 0.0.0.0 netmask 0xff000000 broadcast 255.255.255.255
	media: IEEE 802.11 Wireless Ethernet OFDM/48Mbps mode 11g
	status: associated
	ssid Fortune_6 channel 6 (2437 MHz 11g) bssid 00:0a:79:bd:b0:08
	country US authmode OPEN privacy ON deftxkey 1 wepkey 1:104-bit
	txpower 15 bmiss 10 scanvalid 450 bgscan bgscanintvl 300
	bgscanidle 250 roam:rssi 7 roam:rate 5 protmode CTS wme roaming MANUAL
```
And wpa_supplicant.conf

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

network={
        ssid="WEP_AP"
        key_mgmt=NONE
        wep_key0="KEY"
        wep_tx_keyidx=0
        priority=1
#       auth_alg=SHARED
}
```

My home had a AP (FON), I tried to use its WPA2 private connect,  It couldn't connect ALSO, part of wpa_supplicant.conf is..

```
network={
        ssid="FON"
        key_mgmt=WPA-PSK
        scan_ssid=1
        proto=WPA
        pairwise=TKIP
        group=TKIP
        psk="FON_S/N"
#       priority=1
}
```

Thanks your help !


----------



## kalebman5000 (Jul 10, 2010)

I have the same problem as well. I'm using Atheros Ar9280, so I guess it's not specific to your driver.

I've tried basically everything. It simply doesn't work.


----------



## kalebman5000 (Jul 10, 2010)

Actually, I (not intentionally ) set my wlan0 to WPA/WPA2 mode, and it worked. I have no idea how that works with a WEP AP and Key.


----------



## epopen (Jul 10, 2010)

Problem solved.
I use wpa_gui (/usr/ports/net/wpa_gui).
It can help us to configure correct paramater for wpa_supplicant in /etc/wpa_supplicant.conf
I recommed it to every FreeBSD user !
Thanks.
Neko


----------

