linux:linux-as-router
Linux as router with iptables
sudo sysctl -w net.ipv4.ip_forward=1 sudo iptables -t nat -A POSTROUTING --out-interface wlan1 -j MASQUERADE sudo iptables -A FORWARD -i wlan1 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT sudo iptables -A FORWARD -i eth0 -o wlan0 -j ACCEPT
In this case, wlan1 is where all the traffic will be routed to.
Solve problem of unreachable networks
Probably it needs to set metrich in “/etc/dhcpcd.conf”
interface wlan0 metric 100
linux/linux-as-router.txt · Last modified: 2023/02/12 20:13 by els