User Tools

Site Tools


tunneling_with_dreamcompute

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tunneling_with_dreamcompute [2017/03/10 16:49] jtkorbtunneling_with_dreamcompute [2022/11/13 07:29] (current) jtkorb
Line 3: Line 3:
 These steps set up remote access to a home network using an ssh tunnel to a DreamCompute host. These steps set up remote access to a home network using an ssh tunnel to a DreamCompute host.
  
-  - Create a [[https://www.dreamhost.com/cloud/computing|DreamCompute]] instance (default parameters OK)+  - At the DreamCompute [[https://iad2.dreamcompute.com/project/security_groups/|Security Groups]] and [[https://iad2.dreamcompute.com/project/key_pairs/|Key Pairs]] panels..
-  On home UNIX server, create a key pair and upload the public key for access to the instance. +    Create a new Security Group ruleset.  Add rules to open the desired ports, including port 22 for ssh and some random port (say, 1234) for remote access to the home server.  For exampleto open port 22 use parameters: Custom TCP Rule, Ingress, Port 22, Remote CIDR = 0.0.0.0/0. 
-  - Edit ''/etc/ssh/sshd_config'' and add this at the end:<code>+    - Create Key Pair, download the private key (e.g., ''cloud.pem''), and put it in the home server ''~/.ssh'' directory. 
 +  - At the DreamCompute [[https://iad2.dreamcompute.com/project/instances|Instances]] panel, launch a new instance (Boot Source Image Ubuntu 16.04, Flavor gp1.subsonic), selecting the newly created Security Group and Key Pair
 +  - Create an A-type DNS record for the DreamCompute IP address with a name like ''casa.example.com'' (Alternative: Use duckdns.org to create a public domain name.) 
 +  - Using ssh from home machine, connect to Dreamhost instance (e.g., ''ssh -i .ssh/cloud.pem ubuntu@casa.example.com'').  Edit ''/etc/ssh/sshd_config'' and add this configuration information at the end (assuming default user is ''ubuntu''):<code>
 ClientAliveInterval 30 ClientAliveInterval 30
 ClientAliveCountMax 3 ClientAliveCountMax 3
Line 11: Line 14:
 Match User ubuntu Match User ubuntu
     GatewayPorts yes     GatewayPorts yes
-</code> +</code>This step also ensures that the Dreamhost instance is added to the local ''~/.ssh/known_hosts'' file
-  - Edit the [[https://iad2.dreamcompute.com/project/access_and_security|Access & Security]] settings:<code> +  - While connected to the Dreamhost instance, do ''sudo apt-get'' and ''update'', ''upgrade'', ''dist-upgrade'', and ''autoremove''And, reboot
-Manage Rules +  - On home server, create a ''~/.ssh/config'' file with something like this (assuming home server has local IP address 192.168.1.192 and is listening on ssh port 1234)...<code>
-Add Rule: Custom TCP Rule, Ingress, Open Port 12345 (for example), Remote CIDR = 0.0.0.0/0. +
-</code> +
-  - Create an A-type DNS record for the DreamCompute IP address with a name like ''casa.example.com''+
-  - To create and test the tunnel use the command below on the home serverthen try to connect to port 12345 on ''casa.example.com''.<code> +
-$ ssh -NR '*:12345:192.168.1.123:54321' +
-</code> +
-  - On home server, create a ~/.ssh/config file with something like this...<code>+
 Host tunnel Host tunnel
 HostName casa.example.com HostName casa.example.com
 User ubuntu User ubuntu
-IdentityFile ~/.ssh/cloud.key+IdentityFile ~/.ssh/cloud.pem
 BatchMode yes BatchMode yes
 EscapeChar none EscapeChar none
-RemoteForward *:9190 192.168.1.190:2190 +RemoteForward *:1234 192.168.1.192:1234
-RemoteForward *:9191 192.168.1.191:2191 +
-RemoteForward *:9999 192.168.1.192:2222+
 </code> </code>
   - Add this line to crontab:<code>   - Add this line to crontab:<code>
 @reboot autossh -fN tunnel @reboot autossh -fN tunnel
 +</code>
 +  - From laptop (or other remote machine that has a private key paired with a home server public key in the authorized_keys file), use this instruction to remote ssh to account local:<code>
 +ssh local@casa.example.com -p 1234
 </code> </code>
  
tunneling_with_dreamcompute.1489193389.txt.gz · Last modified: 2017/03/10 16:49 by jtkorb