Random Tips & Hints

Monthly Archives: January 2010

Ok, once you have your drivers installed for your WiFi in FreeBSD, you’re ready to setup your WiFi. I’m using an NDIS driver (see my post on Project Evil for more info) – so my wireless device is called ndis0.

I’m going to assume that you are using WPA/WPA2 and DHCP (the most common setup for WiFi) in this document.

To configure your wireless interface, add the following lines into /etc/rc.conf:

wlans_ndis0=”wlan0″
ifconfig_wlan0=”WPA DHCP”

Now we need to configure the WPA/WPA2 settings. I will assume we have 2 wireless networks for this – “wifi1” and “wifi2” which have the WPA/WPA2 keys of “one” and “two” respectively. We will prefer to connect to “wifi1” when possible.

To setup WPA/WPA, edit (or create) the file /etc/wpa_supplicant.conf and add the following:

network={
priority=1
ssid=”wifi1″
psk=”one”
}

network={
priority=2
ssid=”wifi2″
psk=”two”
}

Next time you restart your computer, you will have a ‘wlan0’ interface which will attempt to connect to the listed networks (in order of priority). You can confirm it is associated with ifconfig wlan0 – in my case, i get:

Sooo… if you have a WiFi card that doesn’t have native FreeBSD drivers, you might be able to use ‘Project Evil’ to wrap around the Windows driver for the card. I had to do this on my new netbook…

First, you should install libiconv if you haven’t already. The easiest way is to do:

pkg_add -r libiconv

Next, you need to obtain the Windows driver for the network card (I find that windows 2000 drivers are generally the most reliable). You need the .INF and .SYS files from the driver package. Place these somewhere on your FreeBSD computer (I put mine into /drv/)

Now we need to convert them into an NDIS kernel module… In my case, the files are called net8192se.inf and rtl8192se.sys (RealTek 8191SE 802.11n wireless). To convert them, type (as root):

ndisgen /drv/net8192se.inf /drv/rtl8192se.sys

Press enter until you’re returned to the command prompt, and you will now see a .ko file with the kernel module in. This is named after the .sys file – so in my case, it is called rtl8192se_sys.ko. Copy this file to the /boot/modules/ folder like so:

mv rtl8192se_sys.ko /boot/modules/

and you can activate it by adding the following line to /boot/loader.conf: