Install Hostapd
Follow the steps below to install hostapd.
- Execute the following command to create AP hotpot configured in
hostapd.conf:
hostapd hostapd.conf -B
Example OutputYou can use your phone or computer to locate the hotspot, but you cannot connect to it. To solve this issue, you need to assign an IP address to this hotspot.
- Add subnet to the main configuration file /etc/dhcp/dhcpconf of
dhcp, for
example:
subnet 192.168.0.0 netmask 255.255.255.0 { range 192.168.0.10 192.168.0.20; option routers 192.168.0.1; }
Then, execute the following command to configure the IP address for the WiFi interface:ifconfig wlan0 192.168.0.1
- Execute the following command to troubleshoot the DHCP
server:
dhcpd
Now, you can connect to the hotspot through devices such as mobile phone or PC and ping it for test.
- (Optional) If you want to access the internet through this hotspot, you need to
set up IP forwarding. IP forwarding means that forwards the interface
connecting the network cable on SBC to the wlan0 interface. The following is an
example:
echo 1 > /proc/sys/net/ipv4/ip_forward iptables -F iptables -P FORWARD ACCEPT iptables -t nat -A POSTROUTING -o ethX -j MASQUERADE