Perhaps a future post will demonstrate the use of FreeBSD for wireless AP’s in a commercial environment with roaming. This post will demonstrate a basic home router setup.
Hardware:
- My wireless card (ath0) is equipped with the Atheros chipset.
- Ethernet Nic (re0) is connected to a cable modem.
- Ethernet Nic (em0) is connected to a switch for wired internet access.
Network:
- Internal NAT: 10.0.0.0/24
- We’ll bridge (bridge0) em0 and ath0’s wlan device (wlan0).
- ISC-DHCP31 will respond to DHCP requests.
- Packet Filter (PF) will do our routing.
You will need to know what to replace with your own configuration (not much).
Step 1: Install & Configure ISC-DHCP31 Server
- `cd /usr/ports/net/isc-dhcp31-server`
- `make && make install`
- Add dhcpd_enable=”YES” to your /etc/rc.conf file
- My /usr/local/etc/dhcp.conf looks like this (be sure to change the domain-name and any other custom settings):
subnet 10.0.0.0 netmask 255.255.255.0 { range 10.0.0.2 10.0.0.254; option domain-name-servers 4.2.2.1; option domain-name "CANAAN"; option routers 10.0.0.1; option broadcast-address 10.0.0.255; default-lease-time 600; max-lease-time 7200; } |
Step 2: Configure Network Settings
- Add the following to /etc/rc.conf
pf_enable="YES" pf_rules="/etc/pf.conf" gateway_enable="YES" wlans_ath0="wlan0" create_args_wlan0="wlanmode ap" ifconfig_re0="dhcp" #remember this is my cable modem, it gets an IP address via DHCP cloned_interfaces="bridge0" ifconfig_bridge0="addm wlan0 addm em0" ipv4_addrs_bridge0="10.0.0.1/24" ifconfig_em0="up" ifconfig_wlan0="ssid chicken up" hostname="CANAAN" #You'll want to change this. |
Step 3: Configure Packet Filter
- Add the following to /etc/pf.conf
nat on re0 from 10.0.0.0/24 to any -> (re0) |
REMEMBER: re0 is the ethernet device connected to my cable modem. Your setup WILL be different. Want to learn more about that Packet Filter rule? Here is an EXCELLENT tutorial: http://www.openbsd.org/faq/pf/nat.html
Done! Who thought it could be so simple?
You can either restart your computer or:
- `/etc/rc.d/netif restart`
- `sysctl net.inet.ip.forwarding=1`
- `/etc/rc.d/pf start`
- `/usr/local/etc/rc.d/isc-dhcpd start`