Skip to content

Instantly share code, notes, and snippets.

@bqhuyy
Last active March 28, 2021 15:04
Show Gist options
  • Save bqhuyy/c2ed908fa04f5eafad6b3c3d88fa0e4c to your computer and use it in GitHub Desktop.
Save bqhuyy/c2ed908fa04f5eafad6b3c3d88fa0e4c to your computer and use it in GitHub Desktop.

reverse port forwarding

Dùng để map port máy local đến server
ssh [-f: background] [-N: forwarding only] -R <host_port>:localhost:<client_port> <host_domain>

map port

Dùng để map port server về local
ssh [-f] [-N] -L 0.0.0.0:<client_port>:localhost:<host_port> user@<host_domance> -p <port>

using public ip to host server

  1. open port in router (for public ip) => map local port and public port
  2. use openssh to host server
  • sudo vim /etc/ssh/sshd_config => setting port
  • sudo service ssh start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment