13,420
edits
Changes
no edit summary
<ol><li value="16">Switch to your '''c7host''' VM, and make certain you are logged in as a regular user (i.e. '''NOT root!'''),</li>
<li>We are going to establish a tunnel using a <u>local port</u> (port number: '''20808''') on our '''centos1''' VM that will connect to the <u>remote</u> port: 80 on the '''c7host''' VM.<br>Issue the following command (from c7host): <b><code><span style="color:#3366CC;font-size:1.2em;">ssh -L 20808:centos1:80 yourUserID@centos1</span></code></b><br><br> '''Note:'''<br>The '''-L''' option (which means Local port) takes one argument:<br><span style="courier"><local-port>:<connect-to-host>:<connect-to-port></span><br><br> The command basically connects your local port of 20808 to the remote port of 80 on '''c7host'''.<br>This means all requests to 20808 on the <u>localhost</u> ('''centos1''') are actually tunneled through your ssh connection<br>to port 22 on '''c7host''' and then delivered to port 80 on '''c7host''', bypassing the firewall.<br><br></li>
<li>Once the tunnel is established use '''netstat''' to Open another terminal in your c7host machine, and verify that the port 20808 is listening on '''centos1'''by issuing the command:<br> <b><code><span style="color:#3366CC;font-size:1.2em;">netstat -aunpt | grep 20808</span></code></b></li><li>Now using the browser on switch to your '''centos1''' connect VM and click on the link to see if this tunneling trick works:'''http://localhost:20808'''</li>
<li>You should see the '''index.html''' page on '''c7host'''.</li>
<li>Close the ssh connection and verify that the port 20808 is no longer listening.</li>