i've tried to get port forwarding working on a machine. I've read many topics here regarding that problem, but i can't get it work. Plan is to get all incoming traffic on ppp0 on port 5000 forwarded to a device on eth0. Here are the Rules i have tried (gathered from this site):
iptables -t nat -A PREROUTING -p tcp -i ppp0 --dport 5000 -j DNAT --to-destination 192.168.5.242:5000
iptables -A FORWARD -p tcp -d 192.168.5.242 --dport 5000 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -A POSTROUTING -j MASQUERADE -o ppp0
That didn't work. Next try was this:
iptables -A PREROUTING -t nat -i ppp0 -p tcp --dport 5000 -j DNAT --to 192.168.5.242:5000
iptables -A INPUT -p tcp -m state --state NEW --dport 5000 -i ppp0 -j ACCEPT
iptables -t nat -A POSTROUTING -j MASQUERADE -o ppp0
When accessing that machine on that port i get a connection refused without those rules and a connection timeout with the rules. So something is working, but not in the way intended.
How can i check what i'm doing wrong?