hi , i needed some port forwarding with socat or anything to connect my vps2 to my vps1 and load user and pass from it . i use vps1 and vps2 for openssh vpn so my users can get free internet without any filtering , someone helped me and i managed to port forward my ssh and load the user data on my vps1 with making this service file :
[Unit] Description=SSH Forwarding Service After=network.target [Service] User=nobody ExecStart=/usr/bin/socat TCP-LISTEN:22,fork,reuseaddr TCP:vps1.example.com:22 [Install] WantedBy=multi-user.target
but i also have v2ray panel on my vps1 with 2 config , one of em on port 443 with TLS on and cer , key file on my vps1 , the other on port 13081 without TLS . so i made 2 more file like this :
[Unit] Description=SSH Forwarding Service After=network.target [Service] User=nobody ExecStart=/usr/bin/socat TCP-LISTEN:13081,fork,reuseaddr TCP:vps1.example.com:13081 [Install] WantedBy=multi-user.target
both port 2255 and 13081 works fine but the port 443 that has TLS config doesnt work .
when i use this :
socat TCP-LISTEN:2255,fork TCP:sd1.aronashop.xyz:2255|socat TCP-LISTEN:443,fork TCP:sd1.aronashop.xyz:443|socat TCP-LISTEN:13081,fork TCP:sd1.aronashop.xyz:13081
all work fine even port 443 but the problem is when i close the SSH window it stops .
so how can i fix this port 443 problem ? i tried so many ways but none of em worked
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Click below to sign up and get $200 of credit to try our products over 60 days!
I just answered the question you provided here and in https://www.digitalocean.com/community/questions/how-to-forward-open-ssh-from-vps-to-vps?comment=196105. Sorry for the delay!
Anyway, I’ll post it here just to be sure:
To make the socat command run as a background process even after closing the SSH window, you can use the
nohupcommand combined with
&. However, I recommend creating a systemd service for each port you want to forward, just like you did for port 22
/etc/systemd/system/v2ray-443-forward.servicewith the following content:
Do the same for the other ports (e.g., 13081) if you haven’t already created a systemd service for them.
Now, when you close your SSH window, the socat processes will continue to run in the background, managed by systemd.