# FreeBSD and wlan trouble (arp)



## miggel13 (Jul 5, 2011)

Hello BSD users, 

I want to set up a FreeBSD system with WLAN. I followed a good manual and I am able to connect with my Fritzbox 7270 (encryption: WPA, I see it on the web fronted of my Fritzbox that my BSD host is connected) but it's not possible to send ICMP messages (ping requests) to my router, or from my router to my FreeBSD system (it's not possible to reach any host from my FreeBSD host). I seems that arp is not working correctly: 

(for the next few lines: my FreeBSD system's IP is 192.168.178.20 (dhcp), my router is 192.168.178.1, and there are other hosts on the network: 192.168.178.185 and 192.168.178.189.)


```
nyx# less /etc/wpa_supplicant.conf 
ctrl_interface=/var/run/wpa_supplicant
eapol_version=1
ap_scan=1
network={
  ssid="myssid"
  scan_ssid=1
  proto=RSN
  key_mgmt=WPA-PSK
  pairwise=CCMP
  group=TKIP
  psk="4444444444444444"
}
```

Networkadapter: 

```
nyx# ifconfig ath0
ath0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 2290
	ether 00:09:5b:ec:ef:a0
	media: IEEE 802.11 Wireless Ethernet autoselect (autoselect)
	status: no carrier
```

When I create my device: 

```
nyx# ifconfig wlan0 create wlandev ath0
nyx# ifconfig wlan0 up scan
nyx# ifconfig wlan0 list scan
SSID/MESH ID    BSSID              CHAN RATE   S:N     INT CAPS
myssid   x:x:x:x:x:x   10   54M -74:-96  100 EPS  RSN WPA WME HTCAP ATH WPS
```

Setting up a connection: 

```
nyx# wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf 
CTRL-EVENT-SCAN-RESULTS 
Trying to associate with x:x:x:x:x:x (SSID='myssid' freq=2457 MHz)
Associated with x:x:x:x:x:x
WPA: Key negotiation completed with x:x:x:x:x:x [PTK=CCMP GTK=TKIP]
CTRL-EVENT-CONNECTED - Connection to x:x:x:x:x:x completed (auth) [id=0 id_str=]
```
Everything seems to work: 

```
nyx# dhclient wlan0
DHCPREQUEST on wlan0 to 255.255.255.255 port 67
DHCPACK from 192.168.178.1
bound to 192.168.178.20 -- renewal in 432000 seconds.
```
Output of ifconfig: 


```
nyx# ifconfig wlan0
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	ether 00:09:5b:ec:ef:a0
	inet 192.168.178.20 netmask 0xffffff00 broadcast 192.168.178.255
	media: IEEE 802.11 Wireless Ethernet OFDM/36Mbps mode 11g
	status: associated
	ssid myssid channel 10 (2457 MHz 11g) bssid x:x:x:x:x:x
	country US ecm authmode WPA2/802.11i privacy ON deftxkey UNDEF
	TKIP 2:128-bit txpower 24 bmiss 7 scanvalid 450 bgscan bgscanintvl 300
	bgscanidle 250 roam:rssi 7 roam:rate 5 protmode CTS wme burst
	roaming MANUAL
```
but ...

```
nyx# ping 192.168.178.1
PING 192.168.178.1 (192.168.178.1): 56 data bytes
ping: sendto: Host is down
ping: sendto: Host is down
ping: sendto: Host is down
ping: sendto: Host is down
^C
--- 192.168.178.1 ping statistics ---
9 packets transmitted, 0 packets received, 100.0% packet loss
```
The output of arp: 

```
nyx# arp -a
? (192.168.178.20) at 00:09:5b:ec:ef:a0 on wlan0 permanent [ethernet]
? (192.168.178.1) at bc:05:43:3e:fe:d7 on wlan0 expires in 1174 seconds [ethernet]
```
First, I thought it's a routing problem, but... everything seems ok: 

```
nyx# netstat -rn
Routing tables

Internet:
Destination        Gateway            Flags    Refs      Use  Netif Expire
default            192.168.178.1      UGS         0        0  wlan0
127.0.0.1          link#4             UH          0        0    lo0
192.168.178.0/24   link#5             U           0       20  wlan0
192.168.178.20     link#5             UHS         0        0    lo0
```


See also the tcpdump and messages file. 

It would be nice if anyone can help me! 

Thanks Christian.


----------



## SirDice (Jul 5, 2011)

It seems it's your router that doesn't work correctly.


```
14:42:14.161794 ARP, Request who-has 192.168.178.20 tell 192.168.178.185, length 28
14:42:14.161806 ARP, Reply 192.168.178.20 is-at 00:09:5b:ec:ef:a0 (oui Unknown), length 28
```

There's also traffic flowing from your FreeBSD machine to your router:

```
14:42:28.452781 IP 192.168.178.20.64343 > 192.168.178.1.domain: 41032+ PTR? 2.0.16.172.in-addr.arpa. (41)
14:42:28.652324 IP 192.168.178.20.31323 > 192.168.178.1.domain: 59070+ PTR? 1.178.168.192.in-addr.arpa. (44)
```
This means ARP works, otherwise you'd never see the above.

However, your router doesn't seem to respond to anything.


----------



## miggel13 (Jul 5, 2011)

Thanks for replying. But the router works for all other network clients (Linux and Windows machines). I have no MAC filters or something else. Before FreeBSD, I used Linux on this system and it also worked.


----------



## SirDice (Jul 6, 2011)

Does it work if you use a wired connection to the router?


----------



## miggel13 (Jul 6, 2011)

Yes, it works with a wired connection.


----------



## SirDice (Jul 6, 2011)

Could you try it again, from the start? Just destroy the wlan0 interface and start again.

While doing that run:
`# tcpdump -n ether host 00:09:5b:ec:ef:a0`
This will grab only the traffic to/from your wireless card (so we don't get any clutter from the other devices).


----------



## nslay (Jul 7, 2011)

*FreeBSD and wpa_supplicant*

I have a similar problem (using ath(4)), only dhclient doesn't even work. If I give myself an IP, I can't even ping the router or resolve its MAC address. However, wpa_supplicant authenticates just fine.

Since I don't observe this problem when *not* using wpa_supplicant, my guess is that something is funny with wpa_supplicant and maybe ath or wlan.


----------



## miggel13 (Jul 7, 2011)

SirDice said:
			
		

> Could you try it again, from the start? Just destroy the wlan0 interface and start again.
> 
> While doing that run:
> `# tcpdump -n ether host 00:09:5b:ec:ef:a0`
> This will grab only the traffic to/from your wireless card (so we don't get any clutter from the other devices).



Thanks for replying. I will try it tomorrow. 

Maybe, there's a general problem with the wpa_supplicant WPA authentication: 

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


----------



## miggel13 (Jul 8, 2011)

Hello, I've tried it again and with the grab of `tcpdump -n ether host 00:09:5b:ec:ef:a0`

It doesn't work, the output shows only the following lines:  

```
nyx# less /tmp/wlan.log 
07:57:28.830798 IP 192.168.178.20.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 00:09:5b:ec:ef:a0, length 300
07:57:28.844822 ARP, Request who-has 192.168.178.20 tell 192.168.178.20, length 46
```

I think it's a problem with the wlan supplicant tool. I've turned to a wired connection, so it is not important to solve the problem but if anyone has an idea, I will give it a try. 

christian


----------



## Shriram (Jul 9, 2011)

when i had the problem, a user posted this: try this : http://www.wonkity.com/~wblock/docs/html/wireless.html


----------



## Shriram (Jul 9, 2011)

try with a wpa_supp containing:

```
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group= group name
ap_scan=1
network={
  ssid= ur ssid
  identity= username
  password= passwd 
  psk= pre shared key
}
```


----------



## nslay (Jul 11, 2011)

The problem is clearly ath(4) not [cmd=]wpa_supplicant[/cmd]. I picked up a Netgear WG311 (v3) today (urtw(4)) and was able to use WPA flawlessly.

Some time ago, I found a message about WPA and ath keycache issues on the mailing lists. CURRENT supposedly has fixes for ath.


----------



## miggel13 (Jul 12, 2011)

@nslay: ok, thanks for the information. 

I will use a wired connection and perhaps, the next release works with my wlan configuration

Thank you all for helping!


----------



## nslay (Jul 12, 2011)

miggel13 said:
			
		

> @nslay: ok, thanks for the information.
> 
> I will use a wired connection and perhaps, the next release works with my wlan configuration
> 
> Thank you all for helping!


I'm sorry, I meant to say that I picked up a WG111 (No edit button). It's a USB 802.11b/g Wi-Fi adapter. You can get one for $20-$30 from Best Buy. It works flawlessly.


----------



## nslay (Jul 12, 2011)

Oh yeah, can also grep for "ath" in dmesg? I have an AR9285 and I also saw messages in the mailing list about transmit instability in AR9280. There is work on radio calibration code. I don't know if CURRENT has this or not.


----------

