WLAN Pi – Bridge Wi-Fi Hotspot to Ethernet Interface
In my previous article, I was explaining how you could configure the WLAN Pi to be used in a hotspot mode. Following the article, the configurations have been added to the new WLAN Pi image (starting at 1.7) and it is now part of the default WLAN Pi image (Thanks to Nigel Bowden and Jerry Olla).
One of the feedback I got is that the Wi-Fi interface is not bridged to the ethernet interface. So, if you are connected to the Wi-Fi network, you will not be able to communicate back to the wired network.
So, in this article, I explain how you can configure the WLAN Pi to allow the Wi-Fi interface to be bridged to the ethernet interface. To make it work, I received huge help from Florent Lassia.
# Uncomment the next line to enable packet forwarding for IPv4 net.ipv4.ip_forward=1
This will enable traffic forwarding between the wlan0 and eth0 interfaces.
# WLAN Pi DHCP Hotspot Server Config # wlan0 DHCP Scope subnet 192.168.88.0 netmask 255.255.255.0 { interface wlan0; range 192.168.88.100 192.168.88.200; option routers 192.168.88.1; option domain-name-servers 1.1.1.1; option domain-name-servers 8.8.8.8; default-lease-time 600; max-lease-time 7200; }
sudo /etc/init.d/isc-dhcp-server restart
[ ok ] Restarting isc-dhcp-server (via systemctl): isc-dhcp-server.service.
# Set the default forward policy to ACCEPT, DROP or REJECT. Please note that # if you change this you will most likely want to adjust your rules DEFAULT_FORWARD_POLICY=“ACCEPT”
# NAT rule to nat the Hotspot network behind the Ethernet interface *nat :POSTROUTING ACCEPT [0:0] -A POSTROUTING -s 192.168.88.0/24 -o eth0 -j MASQUERADE COMMIT
sudo ufw disable && sudo ufw enable
Firewall stopped and disabled on system startup Command may disrupt existing ssh connections. Proceed with operation (y|n)? y Firewall is active and enabled on system startup
You can now reboot the WLAN Pi into the hotspot mode using the buttons and it should reboot in the Hotspot mode supporting these bridging configurations. You should be able to connect a client device to the Wi-Fi network and get network connectivity to the LAN if the WLAN Pi is connected to your LAN.
The plan now is to integrate this into the next version of the WLAN Pi image so it could be enabled by default in the Hotspot mode. To be continued…