Answer the question
In order to leave comments, you need to log in
iptables rule, what's wrong?
I'm experimenting with routing.
The connection is: my computer -> router -> world.
zz.zz.zz.zzz - static address on the router, the address of my computer in the home network is 192.168.1.100.
I do it like this:
#iptables -t nat -A PREROUTING -p tcp --dport 5656 -j DNAT --to-destination xxx.xx.xx.xxx:80
Answer the question
In order to leave comments, you need to log in
So you're doing all this on a local Linux machine? And redirect local requests through the router to yourself using NAT on the same machine? Monsieur knows a lot :)
It seemed to me that all three who answered before me thought that Linux = router in your description. That's what I thought at first.
In general, do not suffer from garbage, raise a virtual machine, and you will NAT your machine on it.
Forgotten Post-Rooting
iptables -t nat -A PREROUTING -d <адрес-роутера-в-локалке> -p tcp -m tcp --dport 5656 -j DNAT --to-destination xxx.xx.xx.xxx:80
iptables -t nat -A POSTROUTING -d xxx.xx.xx.xxx -p tcp -m tcp --dport 5656 -j SNAT --to-source <адрес-машины-в-локалке>
show all iptables -v -n -t nat -L PREROUTING
Order of rules in iptables matters .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question