I will be showing how to turn the Raspberry Pi into a wireless access point to which other devices can connect basically, we are turning the raspberry pi into a wireless “router”. I will also show us how to set up the wireless access point created to provide (share) internet access to(with) connected devices.
Also, it is possible to Integrate with LTE over USB and ability to work raspberry pi with LTE as an independent mini Wireless router.
A routed wireless access point can be created using the inbuilt wireless features of the Raspberry Pi 3 by using a suitable USB wireless dongle that supports access point mode.
Here's how I have doneGo to this link here to set up your raspberry pi. Once setup is done let’s begin creating Wi-Fi Hotspot with Raspberry Pi.
STEP-1:Raspberry Pi OS Update
As usual, we update the raspberry pi to ensure we have the latest version of everything
sudo apt-get update
sudo apt-get upgradeSTEP-2:Install Access Point Management Software Packages
To work as an access point, the Raspberry Pi needs to have some of the software packages to act as an access point.
Below commands will install the software that makes it possible to set up the pi as a wireless access point and also the software that helps assign a network address to devices that connect to the AP.
sudo apt install hostapd
sudo apt install dnsmasqFinally, install netfilter-persistent and its plugin iptables-persistent. This utility helps by saving firewall rules and restoring them when the Raspberry Pi boots.
sudo DEBIAN_FRONTEND=noninteractive apt install -y netfilter-persistent iptables-persistentBefore going to the next step reboot raspberry pi.
sudo rebootSTEP-3:Set up the Network Router
The Raspberry Pi will run and manage a standalone wireless network. It will also route between the wireless and Ethernet networks, providing internet access to wireless clients. Setting up the Raspberry Pi to act as a server requires us to assign a static IP address to the wireless port. This can be done by editing the dhcpcd config file. To edit dhcpcd.conf file gives the below command.
sudo nano /etc/dhcpcd.confGo to the end of the dhcpcd.conf file and add the following lines
interface wlan0
static ip_address=192.168.4.1/24
nohook wpa_supplicantEnable Routing and IP Masquerading
To allow traffic to flow from one network to the other in the Raspberry Pi, create a file using the following command, with the contents below:
sudo nano /etc/sysctl.d/routed-ap.confFile contents:
# Enable IPv4 routing
net.ipv4.ip_forward=1Enabling routing will allow hosts from network 192.168.4.0/24 to reach the LAN and the main router towards the internet.
This process is configured by adding a single firewall rule in the Raspberry Pi
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADENow save the current firewall rules for IPv4 (including the rule above) and IPv6 to be loaded at boot by the netfilter-persistent service using the below command
sudo netfilter-persistent saveSTEP-5:Configure the DHCP and DNS services for the wireless network
The DHCP and DNS services are provided by dnsmasq. The default configuration file serves as a template for all possible configuration options.
Rename the default configuration file and edit a new one
sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
sudo nano /etc/dnsmasq.confAdd the following to the file and save it,
interface=wlan0
dhcp-range=192.168.4.2,192.168.4.20,255.255.255.0,24h
domain=wlan
address=/gw.wlan/192.168.4.1To ensure WiFi radio is not blocked on your Raspberry Pi, execute the following command:
sudo rfkill unblock wlanThis setting will be automatically restored at boot time. We will define an appropriate country code in the access point software configuration.
STEP-6:Configure the AP Software
Create the hostapd configuration file, located at /etc/hostapd/hostapd.conf, to add the various parameters for your new wireless network.
country_code=IN
interface=wlan0
ssid=SSID
hw_mode=g
channel=7
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=PWD
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMPNOTE :country_code it configures the computer to use the correct wireless frequencies. See Wikipedia for a list of two-letter ISO 3166-1 country codes.
*SSID : Your SSID (my Case DEV_AP01)
*PWD: Your Password (my Case Pi@12345)
To effect the changes made to the Raspberry Pi, reboot the system.
sudo systemctl rebootOnce it comes back up, you should now be able to access the internet by connecting to the Wireless access point created by the Raspberry Pi.
Note: It might take a while for the Wireless access point to become visible after reboot as the Pi needs to boot up before the network activities start
Finally, it's working with L501(LTE module). Internet accessed from L501 and provided to the connected devices.
Thanks for taking the time to read. Feedback and comments are always welcome.









Comments