Answer the question
In order to leave comments, you need to log in
How to change ip address when connecting via ssh using iptables?
The task is as follows:
there is a server on which several interfaces are raised
there is a server where you need to knock - abcd
there is an address from which you need to knock 172.16.80.1 You
need to connect via ssh to the abcd server through the tun0 interface at 172.16.
ssh [email protected] changes ip to abcd and exits the tun0 interface.
I have already tried a bunch of implementation options using iptables, I got to the point that by 172.16.80.1. goes where it is necessary, but not from that interface. used the rule
iptables -t nat -A OUTPUT -d 172.16.80.1 -j DNAT --to-destination a.b.c.d
Answer the question
In order to leave comments, you need to log in
The decision has come. To the rule that I described above, it was just necessary to add the route to ip ro, i.e.
iptables -t nat -A OUTPUT -d 172.16.80.1 -j DNAT --to-destination abcd
ip ro add 172.16.80.1 via [tun_ip]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question