Wifi access point with traffic routed through ethernet

This guide will set up the pi as a wifi access point/router that will forward all traffic received on the wifi interface through the ethernet interface.

Wifi interface requirements

The wifi interface will need to support working as an access point. To check for this follow these steps:

If your devices also support "combinations" of interface modes, you could set it up as a repeater for an existing wifi network, instead of creating a new network, see this.

Set up access point

We need to set up a wireless network, with the pi as access point.

wpa_passphrase={Your Passphrase, beware that there's a minimum length requirement}
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

Setting static wireless interface address

First, we need to set the pi so it has a static address on the wifi interface.

You must not modify /etc/network/interfaces directly. This used to work, but the latest versions of the pi's dhcp client will ignore these modifications and set up a different address.

# Settings for wifi interface
interface wlan0
    #Setting static ip address:
    static ip_address={ip address}/{netmask}

DHCP server on wireless network

The dhcp server will provide computers who connect on the wireless network with addresses.

subnet 10.5.5.0 netmask 255.255.255.0 {
  range 10.5.5.20 10.5.5.30;
  option routers 10.5.5.1;
  option broadcast-address 10.5.5.255;
}

Forward wireless traffic through ethernet

We set up a network. It would be nice if the pi could act as a gateway so that packets received on the network could be forwarded to the internet.

Reset the pi to a pre-routing state

If you want to reset all we did, so that your pi won't be a router anymore, follow these steps.