JonnyQuest
Posts: 13
Joined: Sat Apr 06, 2019 3:09 am

[Solved] Issues creating an access point on RPi 3B+

Mon Apr 08, 2019 3:47 am

I have been following https://github.com/SurferTim/documentat ... s-point.md and https://www.raspberrypi.org/documentati ... s-point.md which look to be the same document. I also looked at the thread on this topic that was started in 2017 which may not be relevant with the newer hardware and OS.

I am starting with a freshly formatted sd card and loading Raspbian Stretch Lite 2018-11-13.

The 1st hurdle I came to was the section "Configuring a Static IP". When I executed the statement

Code: Select all

sudo service dhcpcd restart
My Pi freezes up with the following message:
"Warning: dhcpcd.service changed on disk. Run 'systemctl daemon-reload' to reload units."
I lose network connectivity on eth0 (the static IP was assigned to wlan0). I wait a few minutes then I have to pull the power on the Pi.
After restarting, I can ssh to eth0 again I press on hoping the restart caused the dhcpcd service to restart. I did note that ifconfig shows that there is no IP address assigned to wlan0.

The 2nd hurdle is in the section "Start it up". When I execute the statement

Code: Select all

sudo systemctl start hostapd
I get the message "Failed to start hostapd.service: Unit hostapd.service is masked." This issue was resolved from another post on the forum viewtopic.php?f=28&t=235598&p=1452825#p1452825 The solution is

Code: Select all

sudo systemctl unmask hostapd
sudo systemctl enable hostapd
sudo systemctl start hostapd

Is there a better/updated guide that works with the current version of Raspbian Stretch Lite?
Last edited by JonnyQuest on Mon Apr 08, 2019 9:48 pm, edited 1 time in total.

epoch1970
Posts: 3701
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Issues creating an access point on RPi 3B+

Mon Apr 08, 2019 3:23 pm

"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

JonnyQuest
Posts: 13
Joined: Sat Apr 06, 2019 3:09 am

Re: Issues creating an access point on RPi 3B+

Mon Apr 08, 2019 5:14 pm

I followed the document above and the one change I made to my process is I didn't include my copy of wpa_supplicant.conf (that works) on the boot of the fresh sd install. Instead, I ran raspi-config and only configured the country code.

I did not lock up with the warning on "sudo service dhcpcd restart" this time. I continued with the document until I reached the section "Add routing and masquerade". The following command issues a message:

Code: Select all

sudo iptables -t nat -A  POSTROUTING -o eth0 -j MASQUERADE

iptables v1.6.0: can't initialize iptables table 'nat': Table does not exist (do you need to insmod?) Perhaps iptables or your kernel needs to be upgraded.

System is fully updated. Any ideas?

epoch1970
Posts: 3701
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Issues creating an access point on RPi 3B+

Mon Apr 08, 2019 5:26 pm

wpa-supplicant is for wifi clients.
hostapd is for wifi Access Point (server)
The less they see each other the better. There is no mention of wpa_supplicant.conf in the linked page.

If your system is unable to run iptables, I would suggest reinstalling. Something is quite wrong.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

JonnyQuest
Posts: 13
Joined: Sat Apr 06, 2019 3:09 am

Re: Issues creating an access point on RPi 3B+

Mon Apr 08, 2019 6:00 pm

It is my understanding that the country code must be set to enable wlan0. This produces wpa_supplicant.conf.

After rebooting, my Pi is advertising and I can log in and get an IP in the specified range. Do I need the router/masq rules if I want a small isolated network? There will be no eth0 in my final configuration.

epoch1970
Posts: 3701
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Issues creating an access point on RPi 3B+

Mon Apr 08, 2019 6:13 pm

A masquerade rule takes outgoing traffic off an interface (say wlan0, via the AP) and masquerades it as if it were going off another interface (say eth0, well-known from the LAN router). When the LAN router sees the traffic it OK's it since it comes seemingly from the Pi over eth0.
Upon receiving the answer back, the masquerading interface (eth0) remembers who the data was really from, and forwards it to the origin interface (wlan0 and then on to a wifi client, possibly).

In simple terms, if you create an isolated AP where clients can see each other, the Pi (AP), but not anything else, you do not need masquerading.
And you can also do away with the routing tunable "net.ipv4.ip_forward=1"; Traffic won't be passed from one interface to another within the Pi. A router needs to do that, an isolated machine not.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

JonnyQuest
Posts: 13
Joined: Sat Apr 06, 2019 3:09 am

Re: Issues creating an access point on RPi 3B+

Mon Apr 08, 2019 9:47 pm

If that is the case then my issue is resolved and I don't care about iptables in my instance. Thanks for the response.

Return to “Troubleshooting”