Configuring an access point as a router

Updated: April 19, 2023

To configure an access point as a router:

  1. Make sure the outside network interface on your access point is active. That is, make sure your access point is active on the wired network that it's connected to.
  2. Configure the access point interface. You can do this as follows:
    1. Allow packets coming in from one interface to be forwarded (routed) out another:
      sysctl -w net.inet.ip.forwarding=1
      
    2. Place the wireless interface into access point mode as indicated in the WPA access point section.
  3. Set up DHCP to distribute IP addresses to wireless clients. Full details are given in the Launching the DHCP server on your gateway section. Briefly, you provide a configuration section in dhcpd.conf to define the internal network, as follows:
    subnet 10.42.42.0 netmask 255.255.255.0 {
        range 10.42.0.2 10.42.0.120;
        ...;
    }
    

    Then you run dhcpd:

    dhcpd -cf full_path_to_your_dhcp_config_file -lf full_path_to_your_release_file ni_nic
    

    You don't need to specify where your dhcpd.conf and release file are if you put them in the default place under /etc. For more information, see the entry for dhcpd in the Utilities Reference.

    To use WPA or WPA2, you need to set up and run hostapd (the server-side application associated with the client's wpa_supplicant) to do the authentication and key exchange for your network.

    You can also configure your access point as a NAT network router as follows:

    mount -Ttcpip lsm-pfv4.so
    

    so that the PF module is loaded, and then use pfctl to do the configuration.

    For details of how to configure a NAT, visit http://www.netbsd.org/docs/.