What's new

Redirect and forward traffic between 2 VPS

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.
 

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

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