How to build a wireless 802.11b Access Point using NetBSD

Tested with NetBSD 1.6ZG.

by Hoang Q. Tran

It is really easy to build a wireless access point using NetBSD. Here are the following steps:

Introduction

A typical home network with broadband connection:
               {Internet}
                   |
              -------------
              | Cable/DSL |
              | Modem     |
              -------------
                   |
               ----------
               |  fw/   |
               | router |
               ----------
                   | 192.168.1.1
               ----------          <..............>
               | Switch | --- fxp0 .   NetBSD    .
               ----------      .5  . Access Point .
                   |               <..............>
              -----------                wi0
              ^    ^    ^                 ^
              pc1 pc2  pc3                ^ Netgear MA101
              .2  .3   .4                 ^ .6
                                     <....^.....>
                                     . wireless .
                                     .  client  .
                                     <..........>

What you need

Before you head out to get your wireless pci adapter or pcmcia, make sure it uses one of the following chipsets:
- Lucent Hermes
- Intersil PRISM-II
- Intersil PRISM-2.5
- Symbol Spectrum24
NetBSD access point:
- Dlink DWL-520 PCI Adapter (PRISM-2.5 chipset with support for access point)
- Intel Management Pro/100+
Windows wireless client:
- Netgear MA101 USB Adapter

Recompile the kernel

Update your kernel file with the following and recompile the kernel:
fxp*    at pci? dev ? function ?  # Intel Management Pro/100+
wi*     at pci? dev ? function ?  # Driver for Lucent Hermes, Intersil PRISM-II,
                                  # PRISM-2.5, and Symbol Spectrum24 chipsets
inphy*  at mii? phy ?             # MII bus support
pseudo-device   bridge            # Bridge to ethernet world

Setup

B For the wireless network, we'll use 128-bit key length to authenticate and wired equivalent privacy (WEP) to encrypt the connection between the access point and wireless client.

Create a shell script ap.sh and drop it into //usr/pkg/etc/rc.d:

/usr/pkg/etc/rc.d/ap.sh

#!/bin/sh

#
# Configure the access point mode and call it my_wifi as the network name (ssid)
#
ifconfig wi0 inet up nwid my_wifi media DS11 mediaopt hostap
#
# Choose one of the three non overlapping channels 1,6,11
#
ifconfig wi0 chan 6
#
# Define four 128-bit keys and use key 1 to encrypt transmitted packets. 
# Don't forget to replace the keys since they're just examples here.
#
ifconfig wi0 nwkey 1:0x63600cf60ac36aaad0db111111,0xc08cda7c8faf0ed4e682222222,0xe6ff771b921d86ff7495333333,0x07d0fa0530a6ddf8d007444444
#
# Define station name
#
wiconfig wi0 -s "NetBSD_AP"
To bridge wireless to ethernet world, create /etc/ifconfig.bridge0 as follow:
create
!brconfig $int add wi0 add fxp0 up
To launch ap.sh on startup, edit /etc/rc.local and add the following near the end:
if [ -f /usr/pkg/etc/rc.d/ap.sh ]; then
        /usr/pkg/etc/rc.d/ap.sh
fi
On the wireless client side, simply join the wireless network using the key and use WEP.

Windows wireless client:

Setup the IP Address as 192.168.1.6 netmask 0xffffff00 and DNS server. Then, configure the wireless settings using the Netgear Utility:

- Configuration tab->Network Name: my_wifi
- Security tab->Check `Enable Encryption (Web Key). Key length 128-Bit. Enter key1-4 and select key1 as default
- Click OK
You're now ready to surf the internet using your wireless connection via the broadband cable/dsl modem.

Acknowledgement

Thanks goes to Bill Paul wpaul@FreeBSD.org for writing a great wi(4) driver.

Reference

man wi(4),wiconfig(8),brconfig(8)


last update: Dec 17, 2003