July 16, 2013

Route all traffic to Loopback with iptables


Hello ALL.......!

I am trying to redirect the traffic on the tun0 interface to loopback and I request you to guide me.

I have a tun0 interface and a when a client with an IP of (coming from tun0) wants to access the Internet I do

$ iptables -A POSTROUTING -s -t nat -o wlan0 -j MASQUERADE

and the client successfully connects to the Internet over WIFI.

Now instead of wlan0 I want to redirect all traffic coming from tun0 to Loopback on which I am running a BIND DNS server and also a lighttpd Webserver. I tried with few rules but failed to do so. Can you guide me with the right rule.



Click Here!