FreeBSD Wi-Fi Access Point

Hello everybody,

Today I’m going to tell you how to configure Wireless Access Point on FreeBSD 9.0R Server.
After configuration completed you will have:
1. FreeBSD WiFi access point.
2. Security type: WPA2-PSK
3. Bridge with LAN interface
4. DHCP Server.

Let’s started.
This article will not cover things like FreeBSD installation.

First of all you need to make sure that you have proper Wireless adapter in your system.

# pciconf -lv
[email protected]:1:0:0:        class=0x020000 card=0x7108144f chip=0x001c168c rev=0x01 hdr=0x00
    vendor     = 'Atheros Communications Inc.'
    device     = 'AR242x / AR542x Wireless Network Adapter (PCI-Express)'
    class      = network
    subclass   = ethernet

If yes, please run:
# ifconfig ath0
ath0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 2290
        ether 00:1b:9e:8a:80:2e
        status: running

Now you’re ready to make it operational.
Let’s add these strings into /etc/rc.conf

create_args_wlan0="wlanmode hostap mode 11g channel 6"
ifconfig_bridge0="addm wlan0 addm fxp0 up"
ifconfig_bridge0="inet netmask"

My explanation for the strings above:
Starting from FreeBSD 8.0, there are some changes related to Wireless. So you have to assign virtual interface to physical wireless adapter. In my case it was wlan0 (virtual) and ath0(physical interface). Next you’ll have to configure wireless access point mode (in my case it was 11g and channel 6). After that you have to enable hostapd (AP daemon), create bridge interface and add necessary interfaces to it (e.g. wlan0 and fxp0).

The next step is to configure hostapd.
To make it, go to /etc/hostapd.conf
In my case it would be 802.11g mode and WPA2-PSK security mode.

wpa_pairwise=CCMP TKIP

After reboot you will see your virtual Wireless interface.

# ifconfig wlan0
wlan0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether 00:1b:9e:8a:80:2e
        inet6 fe80::21b:9eff:fe8a:802e%wlan0 prefixlen 64 tentative scopeid 0xc
        regdomain 101 indoor ecm authmode WPA2/802.11i privacy MIXED
        protmode CTS wme dtimperiod 1 -dfs

Next step DHCP Server:

To get automatic IP address assignment, you have to install and configure DHCP.

# cd /usr/ports/net/isc-dhcp42-server/ && make install clean
After that you will need to configure DHCP server.
Please go to the /usr/local/etc/dhcpd.conf and allocate necessary subnet.

subnet netmask {
  option domain-name-servers,
  option routers;
  option broadcast-address;
  default-lease-time 600;
  max-lease-time 7200;

That’s all. Now you can try to search Wireless network with name MY_SSID and connect to it by using key

One thought on “FreeBSD Wi-Fi Access Point

Leave a Reply

Your email address will not be published. Required fields are marked *