# WEP wireless doesn't work



## suhijo (Mar 9, 2011)

Hi guys

I've been reading about configure wireless and wpa works great. But when i try to connect to a wep network and I execute a dhclient on wlan0 I just don't receive and dhcp offers. This is my config:


```
localhost# ifconfig wlan0  list scan
SSID/MESH ID    BSSID              CHAN RATE   S:N     INT CAPS
ActMerch        00:21:29:7d:6e:1c    6   54M -78:-96  100 EP  
NOTARIA16       b4:82:fe:a7:31:87   11   54M -94:-96  100 EP   WPA
```

In /etc/wpa_supplicant.conf


```
network={
        ssid="ActMerch"
        key_mgmt=NONE
        wep_key1="B3EC935CB5"
        wep_tx_keyidx=1
}
```

`# nohup wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf &`


```
CTRL-EVENT-SCAN-RESULTS 
Trying to associate with 00:21:29:7d:6e:1c (SSID='ActMerch' freq=2437 MHz)
Associated with 00:21:29:7d:6e:1c
CTRL-EVENT-CONNECTED - Connection to 00:21:29:7d:6e:1c completed (auth) [id=4 id_str=]
```

`# 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 3
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 3
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 3
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 7
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 13
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 9
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 17
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 6
No DHCPOFFERS received.
Trying recorded lease 192.168.20.214
bound: renewal in 641564 seconds.
```
 
`# ifconfig wlan0`

```
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	ether 00:24:2b:92:95:23
	media: IEEE 802.11 Wireless Ethernet OFDM/48Mbps mode 11g
	status: associated
	ssid ActMerch channel 6 (2437 MHz 11g) bssid 00:21:29:7d:6e:1c
	regdomain 100 indoor ecm authmode OPEN privacy ON deftxkey 2
	wepkey 2:104-bit txpower 20 bmiss 7 scanvalid 450 bgscan
	bgscanintvl 300 bgscanidle 250 roam:rssi 7 roam:rate 5 protmode CTS
	wme burst roaming MANUAL
```

What am I doing wrong?


----------



## richardpl (Mar 9, 2011)

Your configuration is wrong. Keys in hex start with 0x.


----------



## suhijo (Mar 9, 2011)

So, do I have to put "0x" in all of my wep keys for my different wep networks, and thats it?


----------



## richardpl (Mar 9, 2011)

ASCII keys are in quotes, hex keys are without quotes: http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=4&chap=4

Use google.


----------



## disi (Mar 10, 2011)

Just a hunch, wep_key starts at 0:

```
wep_key0="blubblba"
wep_tx_keyidx=0
```


----------



## disi (Mar 10, 2011)

Anyway, the wireless access point is connected. This is a dhcp issue.

Can you give yourself an IP and use the network after you are connected like:

```
# ifconfig wlan0 192.168.1.23 netmask 255.255.255.0
# route add default <IP_of_the_router>
# echo 'nameserver <IP of the DNS>' >> /etc/resolv.conf
```

Maybe dhcp is not enabled on the WEP AP?


----------



## suhijo (Mar 12, 2011)

Oh no, the AP is fine, because I tried with windows and it connects.


----------



## wblock@ (Mar 12, 2011)

MAC address restrictions on the access point or no DHCP server running?


----------



## richardpl (Mar 12, 2011)

What part of my reply you did not understand?

Is wep password in ASCII or HEX?


----------



## cheme (Mar 13, 2011)

I was able to connect to a WEP encrypted network with the following network block added to my /etc/wpa_supplicant.conf  file.


```
[B]# cat /etc/wpa_supplicant.conf[/B]
network={
	ssid="your ssid"
	key_mgmt=NONE
	wep_key0=your password
	wep_tx_keyidx=0
	}
```


----------



## suhijo (Mar 13, 2011)

My password is in ASCII.


----------



## richardpl (Mar 14, 2011)

If your connection is not working you are obviously wrong.

Remove quotes and try again.


----------



## dguruwu (Sep 24, 2012)

I have a suggestion for this old post.  I was recently having a similar problem with a WPA connection.  After the initial setup it worked for a little bit at first, but then would no longer receive DHCPOFFER's from my router.

I pulled my hair out for a while on this and then tried manually specifying IP's (which did not help).  I then dug into IFCONFIG and realized you can manually specify SSID's, and more specifically the channel configuration, which I think is what solved the problem for me.

Read this:

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/network-wireless.html

and the look at the channel section in IFCONFIG:

http://www.freebsd.org/cgi/man.cgi?query=ifconfig&sektion=8

I am using a N band router on channel 11 with a wideband 40 MHz extension channel on SSID center.  So my ifconfig statement in /etc/rc.conf looks like this:

ifconfig_wlan0="WPA DHCP ssid center channel 2462:n/40-"

2463 being the frequency of channel 11.  That seemed to do the trick, it seems that the wireless heuristics with some hardware/software combinations don't always work as I noticed prior to this modification ifconfig reported being associated but connected to channel 8.  That's my guess.  

I'd be curious to know if that works for you.


----------



## dguruwu (Sep 25, 2012)

Correction, the line should read:


```
ifconfig_wlan0="WPA [B]SYNC[/B]DHCP ssid center channel 2462:n/40-"
```

The SYNCDHCP gives the wireless client more time to receive a IP from the DHCP server.  Got that idea from here: 

http://forums.freebsd.org/showthread.php?t=16373

I made that adjustment because although it was working better, it occasionally would not work (receive an IP assignment from the router).

PS.  Type in the second to last line. It should obviously read 2462 not 2463.


----------

