HirbodBehnam / Shadowsocks-Cloak-Installer

A one-key script to setup Cloak plugin with Shadowsocks on your server
GNU General Public License v3.0
408 stars 85 forks source link

Connecting two servers with cloak 2 #44

Closed KourosZanbouri closed 1 year ago

KourosZanbouri commented 1 year ago

First of all, @HirbodBehnam thank you for this amazing script ;)

I have two ubuntu servers ( Server 1and Server 2), And I want to tunnel Server 1 through server 2 with cloak plugin The goal is to connect to S2 ( 192.168.0.5 ) through S1 (192.168.1.1) : client > S1 > S2

How should I config the rules?

HirbodBehnam commented 1 year ago

Hello thanks! You can chain two Cloak connections like so: Client connects to a bare metal Cloak server 1 which is installed on S1. This server forwards it's incoming traffic on port A of S1 (loop-back connection). A Clock client must be running on S1 as well which accepts connections from port A of it's localhost and forwards them to loopback port B on S2. Port B on S2, must be binded by the application which you want to send traffic to. HOWEVER, there is an easier way. Setup Cloak server on S2 and do whatever you want with it's rules. Let's say that Cloak on S2 listens on port C. All you have to do is to forward traffic on port D of S1 to port C of S2. When configuring your client, just use S1:D as the destination address. You can read about TCP forwarding from here or Google: https://serverfault.com/a/140626 https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/security_guide/sec-port_forwarding

KourosZanbouri commented 1 year ago

Thank you for your guidance