Route all traffic to Loopback with iptables
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 192.168.254.2 (coming from tun0) wants to access the Internet I do
$ iptables -A POSTROUTING -s 192.168.254.2 -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.