port from local machine to remote machine

1. execute tunneling command on local machine
ssh -nNT -L8081:marcuschiu-php56.cloudatron.com:8080 localhost

this will pipe everything from localhost:8081 (your local machine’s port 8081) to marcuschiu-php56.cloudatron.com:8080 (the remote machine’s port 8080).

2. Test the tunneling

  • Open a new terminal and execute

    ssh marcuschiu-php56.cloudatron.com

    then in your remote machine execute

    nc -l 8080

    this command will have remote machine listen on port 8080

  • Open a new terminal and execute

    echo “Hello World” | nc localhost 8081

    this will push “Hello World” into the localhost port 8081 which is your LOCAL machine’s port 8081.

  • go back to the terminal where you executed ‘nc -l 8080’

    you should see “Hello world”