# wifi question



## qsecofr (Mar 11, 2013)

Hi,

I'm trying to set up wireless on a Lenovo T60 laptop.  It's running FreeBSD-9.1-RELEASE, upgraded from source (from 7.2-REL, to 8.1-REL, to 9.1).  I currently have a working wireless AP, to which Windows clients connect and use.

T60 appears to associate, and receives a DHCP lease and IP address on the correct subnet.  But networking after that point is a dead end.  No route to host.  No default route.  DHCP appears not to assign one, and neither specifying it in /etc/rc.conf nor manually by the route command work. In addition, maybe as a result of no network, console receives periodic notices that read:

```
wpi0: need multicast update callback
```

/boot/loader.conf reads

```
kern.maxfiles=25000
if_wpi_load="YES"
legal.intel_wpi.license_ack="1"
wlan_ccmp_load="YES"
wlan_tkip_load="YES"
```

/etc/rc.conf reads

```
hostname="T60.mydomain.com
ifconfig_em0="DHCP"
wlans_wpi0="wlan0"
ifconfig_wlan0="WPA DHCP"  #tried option SYNCDHCP also to no avail
ipv6_network_interfaces="none"
ipv6_activate_all_interfaces="NO"
defaultrouter="192.168.2.1"
moused_enable="YES"
dbus_enable="YES"
hald_enable="YES"
nfs_client_enable="YES"
```

/etc/wpa_supplicant.conf reads

```
network={
ssid="mywifi"
psk="mykey"
}
```


```
# netstat -rn
Routing tables

Internet:
Destination        Gateway   Flags  Refs  Use  Netif  Expire
127.0.0.1          link#8    UH        0    0    lo0
192.168.2.18       link#9    UHS       0    0    lo0  =>
192.168.2.18/32    link#9    U         0    0  wlan0

Internet6:
Destination        Gateway   Flags  Netif  Expire
::/96              ::1       UGRS     lo0
::1                link#8    UH       lo0
::ffff:0.0.0.0/96  ::1       UGRS     lo0
fe80::/10          ::1       UGRS     lo0
fe80::%lo0/64      link#8    U        lo0
fe80::1%lo0        link#8    UHS      lo0
ff01::%lo0/32      ::1       U        lo0
ff02::/16          ::1       UGRS     lo0
ff02::%lo0/32      ::1       U        lo0
```


```
# wpa_supplicant -BddK -i wlan0 -c /etc/wpa_supplicant.conf
Initializing interface 'wlan0' conf '/etc/wpa_supplicant.conf' driver 'default'
ctrl_interface 'N/A' bridge 'N/A'
Configuration file '/etc/wpa_supplicant.conf' -> '/etc/wpa_supplicant.conf'
Reading configuration file '/etc/wpa_supplicant.conf'
Line: 1 - start of a new network block
ssid - hexdump_ascii(len=6):
    6d 79 etc                mywifi
PSK (ASCII passphrase) - hexdump_ascii(len=5):
    6d 79 etc                mykey
Priority group 0
    id=0 ssid='mywifi'
Own MAC address: 00:13:02:etc
wpa_driver_bsd_del_key: keyidx=0
wpa_driver_bsd_del_key: keyidx=1
wpa_driver_bsd_del_key: keyidx=2
wpa_driver_bsd_del_key: keyidx=3
wpa_driver_bsd_set_countermeasures: enabled=0
RSN: flushing PMKID list in the driver
Setting scan request: 0 sec 100000 usec
EAPOL: SUPP_PAE entering state DISCONNECTED
EAPOL: Supplicant port status: Unauthorized
EAPOL: KEY_RX entering state NO_KEY_RECEIVE
EAPOL: SUPP_BE entering state INITIALIZE
EAPOL: EAP entering state DISABLED
EAPOL: Supplicant port status: Unauthorized
EAPOL: Supplicant port status: Unauthorized
Added interface wlan0
Daemonize..
```

ssid and key changed here, but appear to correspond with server settings.
server's /etc/hostapd.conf reads

```
ctrl_interface=/var/run/hostapd
ssid=mywifi
wpa=1
wpa_passphrase=mykey
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP TKIP
```
And the server's /var/log/hostapd.log file includes lines like:

```
STA 00:13:02:etc WPA: group key handshake completed (WPA)
```

So, even if wpa_supplicant produces EAPOL output reading "Unauthorized", it seems as if the handshake completes.

I'm left to wonder if there's some network setting that prevents adding a route back to the gateway.  Even once connected, and having an IP, manually trying to add a default route fails.

Any suggestions appreciated.


----------



## qsecofr (Mar 11, 2013)

I think I may have resolved this with /etc/dhclient-enter-hooks as described in http://forums.freebsd.org/showthread.php?t=13812

At the very least, I can now ping the gateway and beyond into the net.  


```
add-new_routes() {
  route add -net 192.168.2.1 -iface $new_ip_address
  route add default 192.168.2.1
```


----------



## SirDice (Mar 12, 2013)

Your default gateway should be supplied by your DHCP server. You might want to check its settings.

There should be no need for the dhclient-enter-hooks script.


----------



## qsecofr (Mar 12, 2013)

That's what I thought: the DHCP server would supply the default gateway/route.  And it does when wired up to ether, perfectly.  And appears to to do for the Windows clients that connect wirelessly.  That's what had me confused, not knowing if I had misconfigured wireless settings.  

For now, until I can figure it out, the script will stick around.


----------

