K
K
Kalombyr2020-05-07 19:24:14
iptables
Kalombyr, 2020-05-07 19:24:14

Redirect traffic from one ip to another?

Greetings!
There is a gateway on which you need to redirect all traffic (any port and protocol) from one IP to another.
For example, redirect everything from 192.168.0.101 to 192.168.0.100 and back:
I write:

iptables -t nat -A PREROUTING -d 192.168.0.101 -j DNAT --to-destination 192.168.0.100
iptables -t nat -A POSTROUTING -d  192.168.0.100 -j SNAT --to-source 192.168.0.101

ip_forward is enabled.

Anyway, the ping on 101 does not pass (on 100 passes).
Can you please tell me what is wrong and what needs to be added/removed?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Sechin, 2020-05-07
@tamogavk

Are these hosts accessed from the outside via a gray IP?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question