# wireless networking iwi0



## c00kie (Dec 16, 2012)

hi 

I'm not having much luck with an iwi0 wireless network inteface card on an old laptop (using NAT on a home network). Here's the background/configuration(s):

FreeBSD 9.0-RELEASE

`# ifconfig`

```
...
iwi0: staus: no carrier
```


/boot/loader.conf 


```
if_urtw_load="YES"
legal.intel_iwi.license_ack=1
iwi_bss_load="YES"
iwi_ibss_load="YES"
iwi_monitor_load="YES"
wlan_wep_load="YES"
wlan_tkip_load="YES"
wlan_ccmp_load="YES"
```


/etc/wpa_supplicant.conf

```
ctrl_interface=/var/run/wpa_supplicant
eapol_version=2
ap_scan=1
fast_reauth=1
network={
        ssid="myssid"
        psk="myultrasecretkey"
}
```

/etc/rc.conf


```
hostname="example.example.com"
ifconfig_re0="DHCP"
mouse_enable="YES"
dumpdev="AUTO"
wlans_urtw0="iwi0"
ifconfig_wlan0="WPA SYNCDHCP"
```



On startup, FreeBSD will automatically connect. It doesn't. I try to ping the router and and external address with no results:

`# ping 192.168.0.1`

```
ping: sendto: No route to host
...
```
`# ping [url]http://www.google.com[/url]`

```
ping: cannot resolve www.google.com: Host name lookup failure
```


`# ifconfig iwi0 up scan`

```
iwi0: timeout waiting for (null) firmware initialization to complete
iwi0: could not load boot firmware (null)
ifconfig: unable to get scan results
```


help


----------



## ChalkBored (Dec 16, 2012)

In /boot/loader.conf
change:

```
if_urtw_load="YES"
```
to

```
if_iwi_load="YES"
```

And in /etc/rc.conf
You should probably change:

```
wlans_urtw0="iwi0"
```
to

```
wlans_wlan0="iwi0"
```


----------



## c00kie (Dec 16, 2012)

ChalkBored said:
			
		

> In /boot/loader.conf
> change:
> 
> ```
> ...



Thanks. I made those changes and it still won't ping to either the router or outside the network.


----------



## ChalkBored (Dec 17, 2012)

I typed the /etc/rc.conf thing backwards.
it should be:

```
wlans_iwi0="wlan0"
```

If that doesn't fix it, see if ifconfig still shows the firmware error.

If it's up but it's status isn't associated, then it's probably an error with /etc/wpa_supplicant

If it's associated, then you should check for problems with the IP address assignment or the default route being wrong. I've had issues with the ethernet configuration clashing with the wireless one.


----------



## c00kie (Dec 17, 2012)

ChalkBored said:
			
		

> I typed the /etc/rc.conf thing backwards.
> it should be:
> 
> ```
> ...



Thanks Chalkbored.

Looking through the boot process:

```
...
Starting wpa_supplicant
wlan0: no link...iwi0: firmware stuck in state 4, resetting, 
iwi0: radio turned off
iwi0: radio turned off
...giving up
```

The 'radio turned off' message means the switch I think. Pressing Fn > F2 on an old laptop switches radio signals on or off. With it switched on I still can't get on the network.



> If it's up but it's status isn't associated, then it's probably an error with /etc/wpa_supplicant



Again from the boot process:

```
iwi0: status: associated
```




> If it's associated, then you should check for problems with the IP address assignment or the default route being wrong. I've had issues with the ethernet configuration clashing with the wireless one.



How do check the IP assignment?
How do I check the default route?


----------



## ChalkBored (Dec 18, 2012)

ifconfig shows the ip details. Since iwi0 is up and associated, it will show everything through *wlan0*.


```
netstat -rn
```
 will show the routing table.


----------



## c00kie (Dec 18, 2012)

ChalkBored said:
			
		

> ifconfig shows the ip details. Since iwi0 is up and associated, it will show everything through *wlan0*.


OK. Are we good with iwi0 up and associated? We could be talking about little green men for all I'm aware of. :\



> ```
> netstat -rn
> ```
> will show the routing table.



`$ netstat -rn`
reveals:

```
Routing tables

Internet: 
Destination	Gateway		Flags	Refs	Use	Netif	Expire
127.0.0.1	link#10		UH	0	28	lo0

Internet6:
...
```

127.0.0.1 looks like an Apache localhost IP. I don't have Apache installed; it's a clean FreeBSD 9 install. I don't see my router address in there either?


----------



## Wiedmann (Dec 18, 2012)

c00kie said:
			
		

> I'm not having much luck with an iwi0 wireless network inteface card on an old laptop (using NAT on a home network). Here's the background/configuration(s):


That's my working setup on:

```
% uname -sri
FreeBSD 9.0-RELEASE-p3 GENERIC
```
for:

```
iwi0: <Intel(R) PRO/Wireless 2200BG> mem 0xe0204000-0xe0204fff irq 11 at device 6.0 on pci2
```




			
				c00kie said:
			
		

> /boot/loader.conf




```
legal.intel_iwi.license_ack="1"
```




			
				c00kie said:
			
		

> /etc/wpa_supplicant.conf




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

network={
        ssid="my_ssid"
        psk="my_psk"
}
```




			
				c00kie said:
			
		

> /etc/rc.conf




```
wlans_iwi0="wlan0"
ifconfig_wlan0="DHCP WPA country DE"
```
Change country to yours. Or don't use it. Default is US. Look at:

```
ifconfig iwi0 list countries
```
for valid ones.

BTW:


			
				c00kie said:
			
		

> ```
> ifconfig iwi0 up scan
> ```


You must use wlan0 for the scan:

```
ifconfig wlan0 scan
```

Also look for "Starting wpa_supplicant." and "DHCPREQUEST" in dmesg. e.g.:

```
dmesg -a | grep -E "iwi0|wlan0|DHCP|wpa"
```


----------



## c00kie (Dec 19, 2012)

Wiedmann said:
			
		

> That's my working setup on:
> 
> ```
> % uname -sri
> ...



Thanks. I followed this to the letter. Check, and triple check. 

`# ifconfig wlan0 scan`

```
SSID/MESH	ID	BSSID			CHAN	RATE	S:N		INT	CAPS
virginmedia...		a0:21:b7:e4:a9:3e	6	54M	-65:-95		100	EP RSN HTCAP WPS WPA WWE
```

Ahah, virginmedia is my carrier or ISP - some light at the end of the tunnel. But still:

`# ping [url]http://www.google.com[/url]`

```
iwi0: device timeout
iwi0: device timeout
```

I'd try:
`# dmesg -a | grep -E "iwi0|wlan0|DHCP|wpa"`

but can't find the 'pipe symbol' key combination on this keyboard. I've tried every key combination: AltGr, Fn and Shift with top left key just under the Esc.

Boy this is a tough one....


----------



## Wiedmann (Dec 19, 2012)

c00kie said:
			
		

> ```
> SSID/MESH	ID	BSSID			CHAN	RATE	S:N		INT	CAPS
> virginmedia...		a0:21:b7:e4:a9:3e	6	54M	-65:-95		100	EP RSN HTCAP WPS WPA WWE
> ```


What is "ifconfig wlan0" showing you?




			
				c00kie said:
			
		

> Ahah, virginmedia is my carrier or ISP - some light at the end of the tunnel.


And "virginmedia..." is the ssid in "/etc/wpa_supplicant.conf"?




			
				c00kie said:
			
		

> I'd try:
> `# dmesg -a | grep -E "iwi0|wlan0|DHCP|wpa"`
> 
> but can't find the 'pipe symbol' key combination on this keyboard. I've tried every key combination: AltGr, Fn and Shift with top left key just under the Esc.



With Num-Lock enabled, you can use "Alt 124". (at least looking at "dmesg -a" is working...)


I guess wpa_supplicant or dhclient is failing. You can do a manual test with:


> wpa_supplicant -d -i wlan0 -c /etc/wpa_supplicant.conf
> dhclient -d wlan0


(ctrl-c to stop dhclient)


----------



## c00kie (Dec 20, 2012)

Wiedmann said:
			
		

> What is "ifconfig wlan0" showing you?
> 
> And "virginmedia..." is the ssid in "/etc/wpa_supplicant.conf"?


Yes.

`# ifconfig wlan0`

```
wlan0: media: IEEE 802.11 Wireless Ethernet autoselect (autoselect)
status: no carrier
ssid "" channel 6 (2437 MHz 11g)
country US authmode WPA1+WPA2/802.11I privacy OFF txpower 0 bmiss 24
```



> I guess wpa_supplicant or dhclient is failing. You can do a manual test with:
> 
> (ctrl-c to stop dhclient)


OK (omitting some details)...

`# wpa_supplicant -d -i wlan0 -c /etc/wpa_supplicant.conf
dhclient -d wlan0`

```
Configuration file '/etc/wpa_supplicant.conf' -> '/etc/wpa_supplicant.conf'

...
ap_scan=1
Priority group 0
	id=0 ssid='virginmedia999999999'

...

EAPOL: Supplicant port status: Unauthorized
EAPOL: Supplicant port status: Unauthorized
Added interface wlan0
State: DISCONNECTED -> SCANNING
Starting AP scan for wildcard SSID

EAOPL: Supplicant port status: Unauthorized
^C
```

Furthermore even after numerous Ctl-c's - leaving the laptop idle - I get a recurring message:


```
iwi0: device timeout
```


----------

