I have the following situation
I would like to make the Internet connection on
wlan0 of the Pi available to all devices connected on
I'am using Raspian Stretch, predictable network interface names disabled,
/etc/network/interfaces is empty, ip4 forwarding enabled,
The Pi receives the
eth0 config from the LAN side DHCP Server and the wlan0 config from the AP "Router".
Following several tutorials here and elsewhere routing traffic from
wlan0 should be straightforward. See, for example, this post eth0 to wlan0 NAT router setup?, this one eth0 to wlan0 NAT router [duplicate] or this Cent OS based solution CentOS / Redhat Linux Internet Connection Sharing.
- SSID1: Subnet 192.168.1.0/24 GW: 192.168.1.1 (on Router in Image)
- SSID2: Subnet 192.168.2.0/24 GW: 192.168.2.1 (on PI:eth0)
- Host1: on Subnet 192.168.1.0/24 GW: 192.168.1.1 (on Router in image)
Unfortunately, none of those solutions which are basically all the same seem to work in the case abvove.
Core step is route traffic from eth0 to wlan0 using iptables
sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
I am able to do this:
- ping or access Host1 from 192.168.2.0/24 by webbrowser
I am not able to access any host on the internet from 192.168.2.0/24 or from the Pi itself
Looks like a gateway or a route is missing? The result of ip route
default via 192.168.2.1 dev eth0 src 192.168.2.1 metric 202
default via 192.168.43.1 dev wlan0 src 192.168.43.100 metric 303
192.168.2.0/24 dev eth0 proto kernel scope link src 192.168.2.1 metric 202
192.168.43.0/24 dev wlan0 proto kernel scope link src 192.168.43.100 metric 303
Now I am at an end with my knowledge, what is missing and what should/could I do? Any help would be appreciated.