make local only daemon listening on different interface (using iptables port forwarding)?
- by UniIsland
i have a daemon program which listens on 127.0.0.1:8000.
i need to access it when i connect to my box with vpn.
so i want it to listen on the ppp0 interface too.
i've tried the "ssh -L" method. it works, but i don't think it's the right way to do that, having an extra ssh process running in the background.
i tried the "netcat" method. it exits when the connection is closed. so not a valid way for "listening".
i also tried several iptables rules. none of them worked.
i'm not listing here all the rules i've used.
iptables -A FORWARD -j ACCEPT
iptables -t nat -A PREROUTING -i ppp+ -p tcp --dport 8000 -j DNAT --to-destination 127.0.0.1:8000
the above ruleset doesn't work.
i have net.ipv4.ip_forward set to 1.
anyone knows how to redirect traffic from ppp interface to lo?
say, listen on "192.168.45.1:8000 (ppp0)" as well as "127.0.0.1:8000 (lo)"
there's no need to alter the port.
thanx