How I have to configure iptables for redirecting traffic between wlan0 to eth0 of a raspberry pi? In my scenario eth0 is the interface connected to the home LAN with static ip, wlan0 is the interface connected to a wireless network with the address attributed from the wireless network dhcp gateway My goal is to communicate with on a web interface (port 80) from any device in my home network. What I reach on my pc browser on has to be the same I reach on the raspberry if I surf to Like raspberry operate as a firewall with address translation for a web server behind him

I've enabled ip forwarding with

$> sudo sysctl -w net.ipv4.ip_forward=1

and used these iptables rules

iptables -A FORWARD -i eth0 -o wlan0 -p tcp --syn --dport 80 -m conntrack --ctstate NEW -j ACCEPT
iptables -A FORWARD -i eth0 -o wlan0 -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -i wlan0 -o eth0 -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j DNAT --to-destination
iptables -t nat -A POSTROUTING -o wlan0 -p tcp --dport 80 -d -j SNAT --to-source

but no success

  • it is unclear what you want to know ... please ask a direct question about the problem
    – jsotola
    May 27 at 16:12


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.