DEV Community

Adam La Rosa
Adam La Rosa

Posted on

Refurbished Wifi Access Points

Loving a good project I once had the idea of taking a spare wifi card and using it as a wifi access point. I plugged it into a box running OpenBSD (of course) and found the following solution.

First enable IP forwarding by uncommenting the line in /etc/sysctl.conf

net.inet.ip.forwarding=1

Then enable PF in /etc/pf.conf to use Network Address Translation. Adding the following lines.

ext_if=em0 #ethernet
int_if=ath0 #wireless
pass out on $ext_if from !($ext_if) to any nat-to ($ext_if)

Update /etc/dhcpd.conf to assign IP addresses.

option domain-name-servers 192.168.1.1, 8.8.8.8;

Enable DNS & DHCP in /etc/rc.conf.local, also adding the following additional lines.

named_flags=""  # this enables DNS
dhcpd_flags="ath0"  # this enables DHCP

Finally the wifi adapter needs to be told how to treat incoming logins.

inet 192.168.1.1 255.255.255.0 NONE media autoselect mediaopt hostap
nwid NETWORK wpakey PASSWORD chan 11

...and with a quick reboot we now have our OpenBSD server acting as a wifi access point! With all the tools such as tcpdump or pfctl available to manipulate data from the device.

Top comments (0)