How to redirect traffic via an intermediate server on the main and back?

we have two servers...
intermediate: X. X. X. X, which is under the domain of the QQQQ.QQQQQ.QQ and main: Y. Y. Y. Y, which is a VPN Outline
You need to redirect traffic via an intermediate server on the main and back.

Do this:
echo 1 > /proc/sys/net/ipv4/ip_forward

iptables -A INPUT -m state --state NEW-m tcp -p tcp --dport XXX -j ACCEPT

iptables-t nat -A PREROUTING policy -p tcp -d X. X. X. X --dport XXX -j DNAT --to-destination Y. Y. Y. Y:YYYYY

iptables-t nat -A POSTROUTING -p tcp --dst Y. Y. Y. Y --dport YYYYY -j SNAT --to-source X. X. X. X

Now the key outline:
ss://ADKFGHAKDFJGHKLAJDFHGKAJDFHG=@Y.Y.Y.Y:XXXXX/?outline=1
make the substitution AI Pesnica and port:
ss://ASDGHAJKGAJHFDGKJAHDFKLJGHAKDHGEI=@X.X.X.X:XXX/?outline=1
and it works...
and when is X. X. X. X in the key prescribed QQQQ.QQQQQ.QQ, the key no longer works...
meanwhile QQQQ.QQQQQ.QQ is fine as you can ping the X. X. X. X

I apologize if crumpled, and without any details. It was written on the inspiration and the courage.
April 19th 20 at 12:23
0 answer

Find more questions by tags Information securityVPNLinux