Raspberry Pi 4 have onboard wireless networking.
I built Raspberry Pi Wi-Fi 5 Router, so I’ll noted that its technical point of view and how to build it.
Specification
H/W : Raspberry Pi 4 Model B 2GB RAM
OS : Raspberry Pi OS 32bit
Technical Point of View
How to build the system
Installing access point daemon “hostapd” and DNS server software”dnsmasq”.
sudo apt install hostapd dnsmasq
Changing static IP address.
sudo nano /etc/dhcpcd.conf
Going to end of file and editing it like the following.
interface wlan0
static ip_address=192.168.5.1/24
nohook wpa_supplicant
Restarting DHCP
sudo systemctl restart dhcpcd
Configurating hostapd.
sudo nano /etc/hostapd/hostapd.conf
interface=wlan0
driver=nl80211
# a is IEEE802.11a(5GHz)
hw_mode=a
channel=36
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ssid=raspberrypi4_router
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=passphrase
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP
ieee80211d=1
ieee80211h=1
ieee80211n=1
require_ht=1
ht_capab=[HT40-][SHORT-GI-20][SHORT-GI-40]
ieee80211ac=1
vht_capab=[SHORT-GI-80][HTC-VHT]
require_vht=1
vht_oper_chwidth=1
vht_oper_centr_freq_seg0_idx=42
Addtionaly, editing access point daemon startup configuration.
sudo nano /etc/default/hostapd
Replacing line with #DAEMON_CONF like the following.
DAEMON_CONF="/etc/hostapd/hostapd.conf"
Configurating dnsmasq
sudo nano /etc/dnsmasq.conf
interface=wlan0
dhcp-range=192.168.5.100,192.168.5.150,255.255.255.0,24h
Starting installed software
sudo systemctl unmask hostapd
sudo systemctl enable hostapd
sudo systemctl start hostapd
sudo systemctl enable dnsmasq
sudo systemctl start dnsmasq
Setting NAPT( IP Masquerade )
sudo nano /etc/sysctl.conf
Changing uncomment the following line
net.ipv4.ip_forward=1
Setting and saving
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sudo apt install iptables-persistent
sudo /etc/init.d/iptables-persistent save
sudo /etc/init.d/iptables-persistent reload
Connecting your wireless devices to Raspberry Pi access point.
Completed !!
One response
I modified sentense of hostapd config