<div dir="ltr"><div style="font-size:small" class="gmail_default">Thanks John for the details.</div><div style="font-size:small" class="gmail_default">It seems OpenVPN is quite doable then ... <br></div><div style="font-size:small" class="gmail_default"><br></div><div style="font-size:small" class="gmail_default">Regarding split tunnels, it is not something I have experience with.</div><div style="font-size:small" class="gmail_default">Rather it is something that needs to be set up, in order to prevent <br></div><div style="font-size:small" class="gmail_default">ALL data from going through the VPS. Say you are traveling, and</div><div style="font-size:small" class="gmail_default">only want the data to your home server to go through the VPN, <br></div><div style="font-size:small" class="gmail_default">but your streaming from Youtube (or whatever streaming service) </div><div style="font-size:small" class="gmail_default">should go to your local provider, and NOT to the VPN, to reduce data </div><div style="font-size:small" class="gmail_default">usage and improve performance.</div><div style="font-size:small" class="gmail_default"><br></div><div style="font-size:small" class="gmail_default">That is what I understand it to be. How to do it depends on the </div><div style="font-size:small" class="gmail_default">specific tunnel or VPN used.</div><div style="font-size:small" class="gmail_default"><br></div><div style="font-size:small" class="gmail_default">As for SSH tunneling, it turned out to be quite simple for certain</div><div style="font-size:small" class="gmail_default">use cases, and for a single or a couple of ports. <br></div><div style="font-size:small" class="gmail_default"><br></div><div style="font-size:small" class="gmail_default">Assume you have a VPS with the domain name of YOUR-VPS.com</div><div style="font-size:small" class="gmail_default">(if you have a fixed IP address, then you can use that too, or a Dynamic </div><div style="font-size:small" class="gmail_default">DNS service). Also assume your shell user name on it is REMOTE_USERNAME.</div><div style="font-size:small" class="gmail_default">And on the machine that is behind a firewall where you can&#39;t open external ports,</div><div style="font-size:small" class="gmail_default">nor can you have a stable external facing IP address, the internal IP address is <br></div><div style="font-size:small" class="gmail_default">192.168.0.50, and the service you want to run is on port 8080.</div><div style="font-size:small" class="gmail_default"><br></div><div style="font-size:small" class="gmail_default">You create a systemd unit file, you do:</div><div style="font-size:small" class="gmail_default"><br></div><div style="font-size:small" class="gmail_default"><span style="font-family:monospace">User=USERNAME<br>ExecStart=/usr/bin/autossh -N \</span></div><div style="font-size:small" class="gmail_default"><span style="font-family:monospace">  -o StrictHostKeyChecking=no \</span></div><div style="font-size:small" class="gmail_default"><span style="font-family:monospace">  -o UserKnownHostsFile=/dev/null \</span></div><div style="font-size:small" class="gmail_default"><span style="font-family:monospace">  -o PubkeyAuthentication=yes \</span></div><div style="font-size:small" class="gmail_default"><span style="font-family:monospace">  -o PasswordAuthentication=no \</span></div><div style="font-size:small" class="gmail_default"><span style="font-family:monospace">  -o ServerAliveInterval=30 \</span></div><div style="font-size:small" class="gmail_default"><span style="font-family:monospace">  -o ServerAliveCountMax=3 \</span></div><div style="font-size:small" class="gmail_default"><span style="font-family:monospace">  -i /home/USERNAME/.ssh/id_ed25519 \</span></div><div style="font-size:small" class="gmail_default"><span style="font-family:monospace">  -R YOUR-VPS.com:18080:<a href="http://192.168.0.50:8080">192.168.0.50:8080</a> \</span></div><div style="font-size:small" class="gmail_default"><span style="font-family:monospace">  -p 22 REMOTE_USERNAME@YOUR-VPS.com</span></div><div style="font-size:small" class="gmail_default"><br></div><div style="font-size:small" class="gmail_default">The -R line is where the magic is. It starts with the name of the external VPS</div><div style="font-size:small" class="gmail_default"><br></div><div style="font-size:small" class="gmail_default">Then because this specific service is HTTP, you need an extra step, to <br></div><div style="font-size:small" class="gmail_default">proxy it in Nginx or Caddy. <br></div><div style="font-size:small" class="gmail_default"><br></div><div style="font-size:small" class="gmail_default">Since my VPS already has Nginx, I chose that route, with this file called</div><div style="font-size:small" class="gmail_default">my.conf, in the directory /etc/nginx/sites-enabled:</div><div style="font-size:small" class="gmail_default"><br></div><div class="gmail_default"><span style="font-family:monospace"><font size="1">server {<br>  server_name <a href="http://subdomain1.YOUR-VPS.com">subdomain1.YOUR-VPS.com</a>;<br>  listen 80;<br>  access_log /var/log/nginx/access-$host.log;<br>  location / {<br>    proxy_pass                         <a href="http://127.0.0.1:18080">http://127.0.0.1:18080</a>; # This is the tunnel port<br>    proxy_http_version                 1.1;<br>    proxy_set_header Host              $host;<br>    proxy_set_header                   Upgrade $http_upgrade;<br>    proxy_set_header                   Connection &#39;upgrade&#39;;<br>    proxy_set_header                   Host $host;<br>    proxy_cache_bypass                 $http_upgrade;<br>    proxy_read_timeout                 90;<br>    proxy_connect_timeout              90;<br>    proxy_buffers                      8 24k;<br>    proxy_buffer_size                  2k;<br>  }<br>}</font></span></div><div style="font-size:small" class="gmail_default"><br></div><div style="font-size:small" class="gmail_default">If you browse to <a href="http://subdomain1.YOUR-VPS.com">http://subdomain1.YOUR-VPS.com</a>, the request will go to Nginx</div><div style="font-size:small" class="gmail_default">which will send it to the tunnel on the VPS, which then sends it to your machine</div><div style="font-size:small" class="gmail_default">behind the firewall, then back. </div><br><div style="font-size:small" class="gmail_default">You can go a step further and setup SSL on Nginx, and the service will be https, </div><div style="font-size:small" class="gmail_default">and not plain text http.</div><div style="font-size:small" class="gmail_default"><br></div><div style="font-size:small" class="gmail_default"><div style="font-size:small" class="gmail_default">It is all transparent, and your application never knows it is behind a tunnel.</div><div style="font-size:small" class="gmail_default"><br></div><div style="font-size:small" class="gmail_default">It gets complicated if you have more services, since you need to have one <br></div><div style="font-size:small" class="gmail_default">port (18080 in the above case) assigned to each tunnel.<br></div><div style="font-size:small" class="gmail_default"><br><br></div></div></div>