So the first part of this was to setup the wifi adapter as an wireless AP which I managed to do.

The wireless adapter address is

The connected device is given an ip address using hostapd between - This works fine.

I have tested this setup with a local webserver (lighttpd) and using the rule in dnsmasq "address=/#/" I was able to redirect all wifi traffic to my local webserver.

I now have setup my webserver on a dedicated PC (connected to a machine which will be controlled via webserver).

I want to redirect all wifi traffic to the ip address of the dedicated PC. When I plug the PC into the eth0 port of the raspi it gains an ip address from the raspi. Which seems like its working well.

Problem is that I can not ping the PC's ip address from my wifi device. I have tried following a few tutorials on how to bridge the two adapters, but this does not seem to be the right solution.

What is the next step, or what is needed to allow me to route all wifi traffic to the ip address of my dedicated PC on the eth0 interface?

  • the PC is directly connected to the eth0? What IP range you are using for eth0? Commented Mar 17, 2017 at 3:58

1 Answer 1


When I was doing a project like this I used iptables. Remove the address=/#/ from dnsmasq. Remove any bridges you setup and try this:

  • Enable IP forwarding: sudo sysctl -w net.ipv4.ip_forward=1
  • sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
  • sudo iptables -t nat -I PREROUTING -p tcp --dport 80 -j DNAT --to-destination
  • sudo iptables -t nat -I PREROUTING -p tcp --dport 443 -j DNAT --to-destination

Change the IP to the ip address of your webserver on the dedicated PC. You may not want to re-route https to your server (the third line above) unless you have a certificate.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.