An Alma Linux laptop has a Lan adapter enp0s31f6 and a Wifi adapter wlp0s20f3.
The Wifi adapter is connected to a WLAN router (Fritz-Box) via DHCP, has the IP address 192.168.78.156 and allows access to the Internet. The standard gateway of the WLAN router is 192.168.78.1. The LAN adapter enp0s31f6 has a static IP address 192.168.1.40 netmask 255.255.255.0. The laptop/adapter is the default gateway of the subnet 192.168.1.0/24 , The devices of the subnet 192.168.1.0/24 should be given access to the Internet via iptables entries.
I try the following:
sudo sysctl -w net.ipv4.ip_forward=1
sudo iptables -t nat -A POSTROUTING -o wlp0s20f3 -j MASQUERADE
sudo iptables -A FORWARD -i enp0s31f6 -o wlp0s20f3 -j ACCEPT
sudo iptables -A FORWARD -i wlp0s20f3 -o enp0s31f6 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo systemctl restart NetworkManager
All devices in the 192.168.1.0/24 network can communicate without any problems.
Access to the Internet from the devices in the 192.168.1.0/24 network is still not possible.
What error am I making?
Do I still need a route for the enp0s31f6 ?