Tested on:Raspberry Pi 3; Raspbian Jessie
Prerequisites:Raspberry Pi with Raspbian Jessie(see steps 1-5 in the Introduction)
10

Configure the Raspberry Pi 3 as Wireless Access Point (WAP) for Raspbian Jessie

Configuring a Raspberry Pi as wireless access point (WAP) is pretty great since it allows setting up a local network without internet access, for example for safe smartphone interfaces and similar.

Here is the tutorial for setting up a WAP with a Wifi dongle and Raspbian Wheezy: WAP on Wheezy.
However, for running a WAP on Raspbian Jessie, some minor changes apply. In Raspbian Jessie, static IPs have to be assigned in /etc/dhcpcd.conf instead of /etc/network/interfaces. So, for setting up a WAP in Jessie, follow the tutorial linked above with these changes:

Do not add

in /etc/network/interfaces.

Instead, open dhcpcd.conf with sudo nano /etc/dhcpcd.conf and add

at the end of the file with X.Y.Z being the same as in the old tutorial.

Additionally, enabling autologin is not required anymore since it is the default for Raspbian Jessie.

Special thanks to Ian Nichols for the help!

Links
Wireless Access Point with a Wifi dongle and Raspbian Wheezy: http://www.knight-of-pi.org/setup-a-raspberry-pi-as-wireless-access-point-wap-with-the-logilink-wl0084b-nl80211/

Knight of Pi

Johannes Bergs aka Knight of Pi. Diploma in Bioinformatics, some Webdesign and Python coding then. Living in the beautiful city of Vienna.

10 Comments

  1. Hi,
    I followed the guide and I got the AP working (It gives a right IP to my tablet according to the ip range set in dhcpd.conf subnet section).
    The problem is that the wlan0 doesn’t forward ipv4 packets to the eth0 of my Rpi3.
    I checked the
    net.ipv4.ip_forward=1
    in /etc/sysctl.conf
    with no success.
    Is there something else I could check?
    Thanks

    • Peter, very good question: i’m having the same issue. I only have a crude solution that works for me, but requires manually bringing down interfaces with ifdown from time to time.
      Stackoverflow offers some help in that direction.
      If you find a clean solution, please let me know!

    • The best way I’ve found around this one is to use iptables… it’s a bit daunting to look at, but the gist of it is you type some commands to do the necessary port forwarding, then use iptables-save to save that configuration to a file then put a command in /etc/rc.local to execute reload that configuration on reboot. This is the contents of the file I created that way (/etc/iptables.ipv4.nat):

      # Generated by iptables-save v1.4.21 on Sun Feb 5 15:50:21 2017
      *filter
      :INPUT ACCEPT [174:29983]
      :FORWARD ACCEPT [0:0]
      :OUTPUT ACCEPT [167:26642]
      -A FORWARD -i eth0 -o wlan0 -m state –state RELATED,ESTABLISHED -j ACCEPT
      -A FORWARD -i wlan0 -o eth0 -j ACCEPT
      COMMIT
      # Completed on Sun Feb 5 15:50:21 2017
      # Generated by iptables-save v1.4.21 on Sun Feb 5 15:50:21 2017
      *nat
      :PREROUTING ACCEPT [43:4525]
      :INPUT ACCEPT [41:4046]
      :OUTPUT ACCEPT [15:2053]
      :POSTROUTING ACCEPT [9:1429]
      -A POSTROUTING -o eth0 -j MASQUERADE
      COMMIT
      # Completed on Sun Feb 5 15:50:21 2017

      So you could create such a file manually by pasting that into a blank file and saving it, then add the following line to /etc/rc.local:
      iptables-restore < /etc/iptables.ipv4.nat

      hope that helps.

      • Hi Ian,
        i’m really interested in you solution, but i can’t replicate your result, sadly.
        Your method above created an iptables description of

        ####################################
        # Generated by iptables-save v1.4.21 on Sat Jul 8 09:59:28 2017
        *nat
        :PREROUTING ACCEPT [3:566]
        :INPUT ACCEPT [2:233]
        :OUTPUT ACCEPT [44:3418]
        :POSTROUTING ACCEPT [38:2911]
        -A POSTROUTING -o eth0 -j MASQUERADE
        COMMIT
        # Completed on Sat Jul 8 09:59:28 2017
        # Generated by iptables-save v1.4.21 on Sat Jul 8 09:59:28 2017
        *filter
        :INPUT ACCEPT [238:25983]
        :FORWARD ACCEPT [0:0]
        :OUTPUT ACCEPT [223:23311]
        -A FORWARD -i eth0 -o wlan0 -m state –state RELATED,ESTABLISHED -j ACCEPT
        -A FORWARD -i wlan0 -o eth0 -j ACCEPT
        COMMIT
        # Completed on Sat Jul 8 09:59:28 2017
        ####################################

        Besides the numbers, that’s very similar to yours. I had to change your “-state” to “–state” to make
        sudo iptables-restore < /etc/iptables.ipv4.nat run. Do you see anything in my iptables that could prevent this from working? Thanks for the effort and sorry for the late reply, anyways!

        Best,
        kop

  2. Hi, thank you for the guide,
    just a question: what if I already have a DHCP server on my lan? Still need I to setup a DHCP for the Rpi3?

    • Yes, if you want to have clients that can connect to it without further configuration.
      Else, static IPs could work…

  3. Thanks for the guide! One question though, why do you have 192.168.1.50/24 and not 192.168.1.0/24 in the dhcpcd.conf?
    Maybe just a typo but if I’m missing something please explain :-)

    • Hi, i always use .50 as custom IP for better memorisation. .0 as final cipher may be problematic for some routers.

  4. Do you have any idea how many devices could successfully connect at once?

    • Sorry but no; would be interest in this, too. HypRiot is and clustering OS for the RPi, that may be interesting for you.
      I’m hoping to make an article on that these days…

Comment

Time limit is exhausted. Please reload CAPTCHA.