Configure WiFi to Ethernet Router

This guide assumes you have already configured WiFi for your router.

Next, we configure the ethernet interface to provide network address translation for our client:

First, in the hypervisor, we configure the proper interfaces:

# cat /etc/hostname.if0

Replace if0 with your actual ethernet device. We are going to assign all clients reserved IPs from the subnet

Make sure to restart networking for this device:

# sh /etc/netstart if0

Next, we enable routing:

# sysctl net.inet.ip.forwarding=1
# echo "net.inet.ip.forwarding=1" >> /etc/sysctl.conf
# sysctl net.inet6.ip6.forwarding=1
# echo "net.inet6.ip6.forwarding=1" >> /etc/sysctl.conf

Next, we configure dhcpd:

# cat /etc/dhcpd.conf                                             
option domain-name "";

subnet netmask {
        option routers;
        option domain-name-servers;
# rcctl enable dhcpd
# rcctl set dhcpd flags if0
# rcctl start dhcpd

You will need to either configure a caching nameserver on the host that listens to address, or choose a free public DNS service.

Finally, because we are using network address translation, we need to add a rule to packet filter:

match out on egress from !(egress:network) to any nat-to (egress:0)

Then reload the ruleset:

# pfctl -f /etc/pf.conf


If networking does not work immediately, try a reboot to ensure that all networking changes were properly applied.