# Wireless Lan Config



## sc362 (May 10, 2009)

Hi,

I have checked and I couldn't find this topic on another thread. I have also read the manual but I am getting stuck, therefore I am posting for some help.

I have a laptop running freeBSD 7.1 stable. I have installed a Linksys Wireless PCMCIA card using ndiswrapper, which has installed fine. Now I am stuck because I am not sure how to connect to my home network. I have tried using ifconfig to enter the details manually but I'm getting nothing. When I scan for networks it just seems to take forever and not actually do anything. Is there a better tool than ifconfig for wireless network? If ifconfig is ok, does anybody know of any good guides for setup?

I tried doing settings such as "ifconfig_ndis0="DHCP" " and I keep getting messages like command not found, even though thats what it says in the manual, I hope someone can help!

Many thanks!


----------



## rocky (May 10, 2009)

I don't know how to fix your problem but showing what I did may help you:

In /etc/rc.conf:


```
ifconfig_ndis0="ssid FOOBAR"
```
(or you can do this by run ifconfig manually, esp. when you are in a coffee box). FOOBAR is your wireless's SSID and you have to type it correctly (FOOBAR is different from FooBar). In most case I have to ask the coffee's boss for that name.

then I run


```
$ dhclient ndis0
```

Or do all in command line (please read FreeBSD's handbook)


```
$ ifconfig ndis0 up
$ ifconfig ndis0 ssid FooBar
$ ifconfig ndis0 list scan
$ dhclient ndis0
```

I am almost happy with this way


----------



## gordon@ (May 10, 2009)

What security is your wireless using? Is it Open, WEP, or WPA?


----------



## SirDice (May 10, 2009)

sc362 said:
			
		

> If ifconfig is ok, does anybody know of any good guides for setup?


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


----------



## nikobordx (May 10, 2009)

Hi,

If your are using WEP encryption, add this to "/etc/rc.conf":


```
ifconfig_ndis0="ssid YOURSSID nwkey 0xYOURWEPKEY DHCP"
```

Nicolas.


----------



## sc362 (May 11, 2009)

Hey,

Many thanks for all of your replies! 

Rocky: Thanks for these tips! I feel like I am tons closer to configuring my ifconfig but It is still failing to connect. I have set my ssid but I am going to attempt to configure my channel aswell cause the default is one and that is not the channel I am on.

Gordon: I am using WPA-PSK encryption. I know that no wireless encryption is 100% but I am using the best one I can for the spread of devices that I own. It also might be relevant to point out that I have a hidden SSID.

SirDice: I appreciate the value of RTFM hehe I have been using the wireless guide but I was getting confused with the underscore but having looked at rockys post I appreciate now that these are commands for the rc.d file.

nicobordx: Hi dude, sorry but I am not using WEP, do you have a similar suggestion for WPA?

I really appreciate everyones help, keep it coming, were nearly there!

Steve


----------



## SirDice (May 11, 2009)

If you use WPA you will need to configure /etc/wpa_supplicant.conf:

```
network={
 ssid="mywifissid"
 psk="mywifipassword"
}
```
Then modify /etc/rc.conf:

```
ifconfig_ath0="WPA DHCP"
```

Start it with */etc/rc.d/netif start*.

(Also covered in the handbook  )


----------



## richardpl (May 11, 2009)

ath0 should be ndis0

make sure that your wpa_supplicant is started with -Dndis flag otherwise it will fail to work.


----------



## sc362 (May 12, 2009)

Hi Guys,

Thanks for the replies again. I have configured my WPA_Supplicant config as the handbook and you guys have suggested. I think though I have narrowed down the problem! I have gone back through the handbook, read it properly and gone through step by step and the point that I become stuck is when it says run the command:


```
ifconfig ndis0 up scan
```

No matter what I do it wont find any networks at all! I have tried un hiding my ssid and the mac it is sat next to finds multiple networks in my vacinity. I have no trouble connecting to my network with my mac either.

I suspect that I might not have loaded a module correctly or something but as the handbook instructs I have loaded the following in /boot/loader.conf:


```
[I]mywirelessdriver[/I]_load="YES"
wlan_scan_ap_load="YES" 
wlan_scan_sta_load="YES"
wlan_wep_load="YES" 
wlan_ccmp_load="YES" 
wlan_tkip_load="YES"
```

I am tempted to search around the ndis site for the drivers for that card, I am just using Linksys's latest.

Any Thoughts?


----------



## SirDice (May 13, 2009)

IIRC the wlan_scan modules don't load during startup. So you may need to load those by hand. kldstat will show you if they're loaded or not.


----------



## nikobordx (May 14, 2009)

Hi,

What say:

```
dmesg | grep ndis0
```

Nicolas.


----------



## sc362 (May 14, 2009)

Hi guys,

Ok, sirDice I have looked at my loaded modules and after running:


```
kldstat -v | grep wlan
```

I come up with the following:


```
349 wlan_amrr
350 wlan_ccmp
351 wlan_tkip
352 wlan_wep
353 wlan
354 wlan_scan_ap
355 wlan_scan_sta
```

I cannot find mention of IIRC in the handbook, do you know which modules they specifically relate to?


----------



## sc362 (May 14, 2009)

Hi nikobordx,

Im replying to you in a separate reply as I need to copy from command prompt lol,

I ran the command as you asked:


```
dmesg | grep ndis0
```

And I got:


```
ndis0: <Linksys Wireless-G Notebook Adapter WPC54G V3> mem 0x88000000-0x88001fff irq 11 at device 0.0 on cardbus0
ndis0: [ITHREAD]
ndis0: NDIS API version: 5.1
ndis0: WARNING: using obsoleted if_watchdog interface
ndis0: Ethernet address: 00:14:bf:9f:ae:d4
```

I hope this shed's some light on my problem lol


----------



## nikobordx (May 15, 2009)

Hi sc362,

Replace your wpa_supplicant.conf in /etc/rc.conf by this:

```
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel
eapol_version=1
ap_scan=1 
fast_reauth=1

network={
        ssid="yourssid"
        proto=WPA
        key_mgmt=WPA-PSK
        pairwise=CCMP TKIP
        scan_ssid=1
        psk="yourpassword"
}
```

After type:

```
wpa_supplicant -B -c /etc/wpa_supplicant.conf -Dndis -i ndis0
```

Does it work ?
What say ifconfig and dmesg ?

Nicolas.


----------



## sc362 (May 16, 2009)

Ok, so i tried what you said but it still doesn't seem to connect. I changed my wpa_supplicant.conf file exactly as you said and it seems to run with wpa_supplicant without any errors. Here are my ifconfig and my dmesg:



```
home# ifconfig ndis0
ndis0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	ether 00:14:bf:9f:ae:d4
	media: IEEE 802.11 Wireless Ethernet autoselect
	status: no carrier
	ssid "" channel 1 (2412 Mhz 11g)
	authmode OPEN privacy OFF bmiss 7 scanvalid 60 protmode CTS
	roaming MANUAL bintval 0
```


```
dmesg | grep ndis0
ndis0: <Linksys Wireless-G Notebook Adapter WPC54G V3> mem 0x88000000-0x88001fff irq 11 at device 0.0 on cardbus0
ndis0: [ITHREAD]
ndis0: NDIS API version: 5.1
ndis0: WARNING: using obsoleted if_watchdog interface
ndis0: Ethernet address: 00:14:bf:9f:ae:d4
ndis0: <Linksys Wireless-G Notebook Adapter WPC54G V3> mem 0x88000000-0x88001fff irq 11 at device 0.0 on cardbus0
ndis0: [ITHREAD]
ndis0: NDIS API version: 5.1
ndis0: WARNING: using obsoleted if_watchdog interface
ndis0: Ethernet address: 00:14:bf:9f:ae:d4
```


----------



## nikobordx (May 17, 2009)

Strange !

The card will try to connect to what? modem router from your ISP or modem router purchased in the market ?

Are you sure it uses wpa psk encryption ?

What say "ifconfig ndis0 scan" ?

Is it possible that you connect by ethernet cable, then you are typing the address (such as 192.168.1.1) to enter the router and see its configuration ?
(For example, my router does not accept wireless card, if I do not put it in "association" mode)

Nicolas.


----------



## sc362 (Jun 9, 2009)

Hi,

Sorry its taken me so long to get back to you guys but I just thought I'd let you know that I've got it sorted. I have bought an Atheros card and it picked it up first time and scanned. It did however take me a while to tweak my wireless settings to get them just right.

I suspect the issue was part with the card drivers and part with my settings. When I get the time i'll try the same settings again with a different card but its working fine with the new card so all done!


----------

