Kernel_Killer
July 17th, 2003, 20:10
Here is a simple setup for setting up a wireless NIC in FreeBSD. It will also work in other BSDs, but might be a bit different.

First look in /etc/defaults, and open up pccard.conf with your favorite editor. In there you will see a list of supported network devices. If yours is in there, then all is good. I wont get into a specific model, but show what you need to know to set it up.

I'm sure you have already powered on your system with the NIC already in, and probably saw some lines during the bootup about 'awi', 'wi', or a 'an' device.

First of run 'pccardc dumpcis' to make sure all is going well. You should get a bunch on information on you wireless card, and all of it's I/O addresses.

Next you need to setup your AP, short for Access Point. Most likely you are using a router, and should enter it, and go to the wireless configuration. Setup the network name, the channel you wish to use, and WEP keys if you wish to use them.

Let's say you used 'WifiNet' as the network name, and channel '2' for the frequency. Also be sure to set it for BSS. You need to use 'wicontrol' to setup your card now. Use '-n' for networkname, and '-f' for your channel. I'll use wi0 as the device. So for that you would execute this command:

wicontrol -i wi0 -n WifiNet -f 2 -p 1

If you need a list of commands use:

wicontrol -h

Or to check your config status:

wicontrol

Now that you have the wireless setup, you need to setup the NIC. First set the IP for your device. I'll use 'wi0' again.

ipconfig wi0 inet 192.168.1.232 255.255.255.0

If you have another NIC in the system, and get an error setting the wifi IP, you might need to bring it down like so:

ifconfig rl0 down

or:

ifconfig dc0 down

After bringing the other interface down, then try setting the wifi IP again. Change to the derectory '/etc' and edit the rc.conf file. Add these lines at the bottom of the file, with the device changed to your device. Once again, I'll use wi0 so you can see where to change it to your device:

[code:1:86f2b4cbc1]
#Make sure this line is already in rc.conf
pccard_enable="YES"
#Add these lines
ifconfig_wi0="inet 192.168.1.232 netmask 0xffffff00"
defaultrouter="192.168.1.100"
hostname="localhost.localdomain"
[/code:1:86f2b4cbc1]

Now when you startup, it will apply that config to the wi0 device.

After setting the IP, set the route:

route add default 192.168.1.100

Next run the command 'netstat -rn'

At the top you should see I line like:

[code:1:86f2b4cbc1]
Destination Gateway Flags Refs Use Netif Expire
default 192.168.1.100 UGSc 0 0 wi0
[/code:1:86f2b4cbc1]

If that line points to another device, you need to change the device like so:

route change -ifp wi0 default 192.168.1.100

There you go. Try pinging sites, and see if you have a connection to your AP. If not, there is obviously a error in your configuration.

For additional troubleshooting on your wifi network, you might find the bsd-airtools quite helpful. You can find the port in /usr/ports/net/bsd-airtools. After you install it you might want to use the application 'dstumbler'. This app will show what networks are in the area, how strong the signal is, and what channel it is using. This can help a lot when misconfiguring your NIC, or realize you are out of range.