By the end of this tutorial you will be able to access your Raspberry Pi 3 as Wi-Fi Hotpot. Before getting started please make sure that your module is ppp Internet connected. If not please follow the steps from tutorial 3.

Here we go;

1. Install required packages:

sudo apt-get install dnsmasq hostapd

2. You need to configure wlan0 with a static IP.

3. If your Raspberry Pi 3 is connected via Wi-Fi, connect it via Ethernet first.

4. Ignore wlan0. For this type
sudo nano /etc/dhcpcd.conf
which opens up dhcpcd configuration file, then add
denyinterfaces wlan0
at the end of it.

5. This step includes configuration of Static IP. Type
sudo nano /etc/network/interfaces
and add/edit wlan0 section to following configuration

Restart dhcpcd with
sudo service dhcpcd restart
then reload the configuration for wlano with
sudo ifdown wlan0
sudo ifup wlan0

Next, we need to configure hostapd.

 6. Create a new configuration file with
sudo nano /etc/hostapd/hostapd.conf
and add the following contents:

**NOTE: You may check if it’s working at this stage by running sudo /usr/sbin/hostapd /etc/hostapd/hostapd.conf . So far if it’s all done right you should be able to see SIXFAB in your network list. Stop it using Ctrl+C and proceed to next step.

7. Now open up the default configuration file typing
sudo nano /etc/default/hostapd
find the line #DAEMON_CONF=""

replace the line with DAEMON_CONF="/etc/hostapd/hostapd.conf".

8. Present dnsmasq config file contains a bunch of informations about how to use it, but it’s majority is useless for us here. It is advised to not delete rather create a new configuration file.
sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
sudo nano /etc/dnsmasq.conf
Paste the following lines into the new file you have just created:

9. Now you will enable packet forwarding. For this, type

sudo nano /etc/sysctl.conf

to open sysctl.conf. Here find the line

net.ipv4.ip_forward=1

And remove # sign from the beginning of the line.

10. Now reboot your Raspberry Pi

sudo reboot

11. Now we will share our Raspberry Pi’s Internet Connection to the devices connected over the wifi by configuring NAT between wlan0 interface and our ppp0 interface. We can do this using following commands

sudo iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
sudo iptables -A FORWARD -i ppp0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i wlan0 -o ppp0 -j ACCEPT

12. This step needs to be repeated every time you reboot the Raspberry Pi. To avoid it, run

sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"

which saves the rules to a file /etc/iptables.ipv4.nat

As you will need to run this after each reboot, open the rc.local file typing

sudo nano /etc/rc.local

and just above the line exit 0, add the following line:
iptables-restore < /etc/iptables.ipv4.nat

13. Start the services:
sudo service hostapd start
sudo service dnsmasq start

Now you will be able to connect to the Internet via Wi-Fi

I would like to thank Phil Martin for his tutorial using your new Raspberry Pi 3 as a WIFI access point with hostapd.

5 thoughts on “Using Sixfab 3G or 4G Raspberry Pi shield as a Wi-Fi Hotspot”

  1. Step 11 states “This needs configuration of NAT between wlan0 and ppp0 interfaces,” but does not offer any steps explaining how to do this. Are there any references you can link to?

  2. This guide does not seem to work stretch. It also appears there may be some information missing for step 11. Are you able to update this post accordingly?

  3. I’m finding all information that I require for my project with the exception of the SIM cards! What provider do I use for these mobile networking hats? Thanks in advance.

Leave a Reply

Your email address will not be published. Required fields are marked *