Answer the question
In order to leave comments, you need to log in
How to redirect traffic from 1 machine to 2?
Good day. What is the point, there is a client with ip 123.xxx and 2 servers with ip 1.xxx and 2.xxx The client sends a request to 1.xxx and you need 1.xxx to redirect all traffic to 2.xxx and also in reverse order. i created 2 iptables entries:
iptables -t nat -A PREROUTING -d 2.xxx -p tcp -j DNAT --to-destination 1.xxx
iptables -t nat -A POSTROUTING -d 1.xxx -p tcp -j SNAT - to-source 2.xxx
As a matter of fact everything works, but there is 1 problem. 2.xxx receives traffic from ip 1.xxx, but it needs to be received from the client's ip (123.xxx) I would be very grateful if you could help me solve the problem. Thanks in advance!
Answer the question
In order to leave comments, you need to log in
and you need to receive from the client's IPIt doesn't work like that. I explain why not.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question