What's new

Redirect and forward traffic between 2 VPS

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

chncar

Occasional Visitor
Hello,

Pls let me know if this post should not be here.

I am runing centos7 in both VPS A and B. They are both connected to internet

In VPS A, I would like to redirect all TCP traffic matching IPSET AAA to VPS B.

In VPS B, I would like to forword all TCP traffic from VPS A, to internet.

Shall I use bellowed commands in VPS A?
iptables -t mangle -A OUTPUT -p tcp -m set --match-set AAA dst -j DNAT --to-destination VPSB IP
iptables -t nat -A POSTROUTING -j MASQUERADE

And in VPS B,
What commands shall I need to use so that the traffic from VPS A can be forwarded to internet?

thank you!
 
Hello,

Pls let me know if this post should not be here.

I am runing centos7 in both VPS A and B. They are both connected to internet

In VPS A, I would like to redirect all TCP traffic matching IPSET AAA to VPS B.

In VPS B, I would like to forword all TCP traffic from VPS A, to internet.

Shall I use bellowed commands in VPS A?
iptables -t mangle -A OUTPUT -p tcp -m set --match-set AAA dst -j DNAT --to-destination VPSB IP
iptables -t nat -A POSTROUTING -j MASQUERADE

And in VPS B,
What commands shall I need to use so that the traffic from VPS A can be forwarded to internet?

thank you!


Fixed. Openvpn did the job.
 

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top