A
A
anig992016-01-25 14:28:08
linux
anig99, 2016-01-25 14:28:08

How to forward a port from an external network to an external network in iptables with ip spoofing?

Good afternoon!
The task is to process an incoming packet on eth0 (ppp0) with an external address from the provider 99.99.99.99 (router) to port 9090 from an unknown address and send it again to the external address 88.88.88.88 (end equipment) on port 8080 (although this is not important, can be changed on the end equipment). In this case, 88.88.88.88 should receive a packet as if from 99.99.99.99. Return packets should go accordingly.
I try something like
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 9090 -j DNAT --to 88.88.88.88:8080
iptables -t nat -A POSTROUTING -p tcp -d 88.88.88.88 -- dport 9090 -j MASQUERADE
but no stone flower comes out. Maybe some forward is missing?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
diafour, 2016-01-27
@diafour

Is the second rule exactly the same? There is a typo in it, it should be --dport 8080

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question