Prerequisites
- RK3568 or RK3588 development board
- Ubuntu or Debian operating system
- AP6275S Wi-Fi module (or compatible)
Setting Up Hostapd for AP Mode
Install Hostapd
sudo apt update
sudo apt install hostapd
Configure Hostapd
Create the configurasion file at /etc/hostapd/hostapd.conf:
interface=wlan0
driver=nl80211
ssid=EmbeddedAP
hw_mode=a
channel=36
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=SecurePass123
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
Modify /etc/default/hostapd to specify the configuration path:
DAEMON_CONF="/etc/hostapd/hostapd.conf"
Enable and start the service:
sudo systemctl unmask hostapd
sudo systemctl restart hostapd
Configuring DHCP Server
Install DHCP Server
sudo apt install isc-dhcp-server
Assign Static IP to WLAN Interface
sudo ifconfig wlan0 192.168.50.1 netmask 255.255.255.0
Conifgure DHCP Server Interface
Edit /etc/default/isc-dhcp-server:
INTERFACESv4="wlan0"
Define DHCP Pool
Update /etc/dhcp/dhcpd.conf with a subnet declaration:
subnet 192.168.50.0 netmask 255.255.255.0 {
range 192.168.50.100 192.168.50.150;
option routers 192.168.50.1;
option domain-name-servers 8.8.8.8, 8.8.4.4;
}
Start DHCP Service
sudo systemctl restart isc-dhcp-server
Verify the interface configuration:
ifconfig wlan0
Enabling Internet Sharing
To share the Ethernet connection (eth1) through the Wi-Fi hotspot:
# Enable IP forwarding
sudo sysctl -w net.ipv4.ip_forward=1
echo "net.ipv4.ip_forward=1" | sudo tee -a /etc/sysctl.conf
# Configure NAT masquerading
sudo iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
# Set up forwarding rules
sudo iptables -A FORWARD -i eth1 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i wlan0 -o eth1 -j ACCEPT