# wlan with ath+wpa, dhcp but no ping or anything else?



## mathiasp (Apr 22, 2011)

I'm looking for some help to understand and maybe debug the following behaviour:

My ath network card on 8-stable associates with my wlan router (AVM Fritz!Box 7270) using WPA or WPA2, dhcp works fine, the route shows my laptop with correct mac address, but ping to the router shows "host down" and http etc. also do not work.

Also pinging the laptop from another device (my smartphone) logged into the same router does not work (the option to allow this is activated in the Fritz!Box).

The same wlan router / laptop combination works fine without encryption. 

I really do not understand how dhcp can work, but nothing else...

Some facts:

```
% uname -a
FreeBSD mp.virtual-earth.de 8.2-STABLE FreeBSD 8.2-STABLE #20: Fri Apr 22 12:45:24 CEST 2011     [email]mathiasp@mp.virtual-
earth.de[/email]:/usr/obj/usr/src/sys/acer5553g  amd64

% ifconfig
ath0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 2290
	ether c8:0a:a9:7c:8b:2a
	media: IEEE 802.11 Wireless Ethernet autoselect mode 11g
	status: associated
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
	options=3<RXCSUM,TXCSUM>
	inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3 
	inet6 ::1 prefixlen 128 
	inet 127.0.0.1 netmask 0xff000000 
	nd6 options=3<PERFORMNUD,ACCEPT_RTADV>
lagg0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	ether c8:0a:a9:7c:8b:2a
	inet 192.168.178.29 netmask 0xffffff00 broadcast 192.168.178.255
	media: Ethernet autoselect
	status: active
	laggproto failover
	laggport: wlan0 flags=4<ACTIVE>
	laggport: alc0 flags=1<MASTER>
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	ether c8:0a:a9:7c:8b:2a
	media: IEEE 802.11 Wireless Ethernet OFDM/36Mbps mode 11g
	status: associated
	ssid "FRITZ!Box Fon WLAN 7270" channel 1 (2412 MHz 11g) bssid bc:05:43:52:c0:ce
	regdomain 101 indoor ecm authmode WPA2/802.11i privacy ON
	deftxkey UNDEF TKIP 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

% dhclient lagg0
DHCPREQUEST on lagg0 to 255.255.255.255 port 67
DHCPACK from 192.168.178.1
bound to 192.168.178.29 -- renewal in 432000 seconds.

% arp -a
? (192.168.178.29) at c8:0a:a9:7c:8b:2a on lagg0 permanent [ethernet]
? (192.168.178.1) at (incomplete) on lagg0 expired [ethernet]

% ping 192.168.178.1
PING 192.168.178.1 (192.168.178.1): 56 data bytes
ping: sendto: Host is down

% route get default
   route to: default
destination: default
       mask: default
    gateway: 192.168.178.1
  interface: lagg0
      flags: <UP,GATEWAY,DONE,STATIC>
 recvpipe  sendpipe  ssthresh  rtt,msec    mtu        weight    expire
       0         0         0         0      1500         1         0 

% cat /etc/resolv.conf
search fritz.box
nameserver 192.168.178.1
```

Excerpt from /etc/rc.conf:


```
ifconfig_alc0="up"
ifconfig_ath0="`ifconfig alc0 ether`"
ifconfig_ath0="ether ${ifconfig_ath0##*ether }"
wlans_ath0="wlan0"
ifconfig_wlan0="ifconfig 0.0.0.0 WPA"
#ifconfig_wlan0="ifconfig 0.0.0.0 ssid MP"
cloned_interfaces="lagg0"
ifconfig_lagg0="laggproto failover laggport alc0 laggport wlan0 SYNCDHCP"
```

Excerpt from wpa_supplicant.conf


```
# allow frontend (e.g., wpa_cli) to be used by all users in 'wheel' group
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel
fast_reauth=0

network={
	ssid="FRITZ!Box Fon WLAN 7270"
	psk="0872550863082776"
	}
```


----------



## cheme (Apr 24, 2011)

Hello,

Your /etc/rc.conf states that your ethernet adapter is alc0, yet the output of your *ifconfig* does not show any ethernet adapter.  Is alc0 correct and is it actually up?  I would check dmesg if you are not sure. 


```
[B]$ dmesg | grep Ethernet[/B]
re0: Ethernet address: ##:##:##:##:##:##
```

Try changing your /etc/rc.conf to match up with example 31-3 of the handbook http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/network-aggregation.html

Here is an example /etc/rc.conf with some comments:


```
ifconfig_alc0="up"
ifconfig_ath0="ether 00:21:70:da:ae:37" ##For debugging just manually insert the mac of your ethernet port.
wlans_ath0="wlan0"
ifconfig_wlan0="WPA"  ##Notice the difference between this line and the line in your [FILE]/etc/rc.conf[/FILE].  
##D0 not place ifconfig to the right of the "=", also don't assign a static ip "0.0.0.0" when you are attempting to use DHCP.  
##It may not matter but for debugings sake lets keep it simple.
cloned_interfaces="lagg0"
ifconfig_lagg0="laggproto failover laggport alc0 laggport wlan0 SYNCDHCP"
```

Make the following changes to your /etc/wpa_supplicant.conf


```
network={
	ssid="FRITZ!Box Fon WLAN 7270"
	psk="0872550863082776"
	}
```

I just changed my /etc/rc.conf to use lagg intergration via the handbok and it worked without any issues.

Good Luck


----------



## mathiasp (Apr 24, 2011)

Thank you for your detailed reply. I've cleaned up my rc.conf accordingly, but everything keeps the same. Also, the lagg setup works just fine when the wlan is open, with no password at all. And my setup worked fine with a different Fritz!Box 7270 maybe four month ago. My main question is: how can dhcp work but nothing else? Does dhcp imply that the WPA connection is up and running, or will dhcp go around WPA?

Cheers,

Mathias


----------



## davidgurvich (Apr 24, 2011)

The router shouldn't provide a dhcp address before confirming the wpa connection.  You could be using a previous lease without making a connection at all.


----------



## cheme (Apr 25, 2011)

Hello,

Well it was worth a try.  

Just a couple of questions?  It looks like you are using a custom kernel.  Have you recompiled your kernel since your last successful connection?  Have you changed anything on your system since your last successful connection?

Good Luck


----------



## fonz (Jul 20, 2011)

> why shouldnt you provide the dhcp address before the wpa connection? could you elaborate?
> THANKS


Actually, I don't think you can initiate WPA(2) before DHCP gives you an IP address...

Fonz


----------



## wblock@ (Jul 20, 2011)

fonz said:
			
		

> Actually, I don't think you can initiate WPA(2) before DHCP gives you an IP address...



WPA is required to associate to the access point.  Once the card has associated, then DHCP can be used to get an IP address.


```
# ifconfig wlan0 create wlandev ath0
# wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf
# dhclient wlan0
```


----------



## fonz (Jul 20, 2011)

*Oops!*



			
				wblock said:
			
		

> WPA is required to associate to the access point.  Once the card has associated, then DHCP can be used to get an IP address.


I think I do the same on my netbook. I therefore stand corrected and will go stand in the corner for a while.

Fonz


----------



## larrypatrickmaloney (Aug 20, 2011)

*I have the same problem.*

I've had my DLink AP for five years, and it's given me nothing but headaches with FreeBSD.

So, I replaced it with  an ASUS RT-n56u.  (Should have bought the CISCO)

I have the same problem, I have wlan0, ath and wpa2, I authenticate to the AP, DHCP
delivers an IP, but I can't ping out.

I'm pulled my hair out going ove the GUI in the AP, tried a bunch of combinations with WPA, WPA2, whitelisting mac addresses, etc, but no joy.

I seem to be connected, but just can't ping the AP, or the net, or anything.

What to do?


----------



## wblock@ (Aug 20, 2011)

ping and other useful ICMP stuff is often dropped.  Try using a browser to get to the web interface of the router.


----------



## sashi (Oct 12, 2011)

hey guys,

i had the same problem with my ath0 since i changed my ap from smc to a linksys e3000 model. it associates, but ping doesn't work. with tcpdump i could see arriving packets, but my station wasn't sending anything.
i applied this patch from the PR 154598, which excactly matches my problem to my 8.2 system and now it works!

here's what i done:
1. get the patches
ar5212_keycache.c.patch
if_ath.c.patch

2. apply them

```
# cd /usr/src/sys/dev/ath/
# patch -p4 < ~/tmp/ar5212_keycache.c.patch 
# patch -p4 < ~/tmp/if_ath.c.patch
# cd ../../modules/ath/
# make clean
# make depend 
# make 
# make install
```

sashi


----------

