Scenes
In an actual development process, the need for ports in the host access outside the LAN, the remote server may be bound to a port remote_port local port port, where data compression is -C, -f is a background operation, only when prompt the user name and password when it is turned to the front desk. -N distal command is not executed, this command is useful when only port forwarding. -g allow remote host connection is a local forwarding ports. -R remote host indicates that the port is mapped to a local port. If -L, sucked local port mapped to the remote host port.
1, is forwarded to the distal end.
ssh -C -f -N -g -L 本地端口:目标IP:目标端口 用户名@目标IP
2, forwarded to the local.
ssh -C -f -N -g –R 本地端口:目标IP:目标端口 用户名@目标IP
Command Description:
-C: the compressed data transmission.
-f: the background to authenticate the user / password, and are usually used in conjunction -N, do not log on to the remote host.
-N: do not execute scripts or commands, usually used in conjunction with -f.
-g: In -L / -R / -D parameters, allowing the remote host to connect to the port forwarding established, if not this parameter, the local host to establish a connection only.
-L local port: Target IP: Destination Port
Forwards the local machine (the client) to specify a port to a remote machine specified port. It works like this, and on the local machine is assigned a socket listening on port port, once you have this port, the connection is forwarded through a secure channel, and the remote host and host of hostport port to establish a connection. You can specify port forwarding in the configuration file .. Only root can forward privileged ports. IPv6 addresses in another format Description: port / host / hostport.
-R local port: Target IP: Destination Port
Forwards remote host (server) to a port terminal designated local machine specified port. Works like this, the remote host is assigned a socket listening on port port, once you have this port, the connection is through safe passage turned out, while the local host and host of hostport port to establish a connection .. You can specify port forwarding in the configuration file. Only log in to the remote host to forward privileged ports with root. IPv6 addresses in another format Description: port / host / hostport.
ssd server sshd service port is logged: -p.
-D harbor
Specify a local machine "dynamic port forwarding '' applications. Works like this, and on the local machine is assigned a socket listening on port port, once you have this port, the connection is forwarded through a secure channel, according to application protocol can be judged and where to connect to a remote host currently supports SOCKS4 protocol, will act as a SOCKS4 server. only root can forward privileged ports. You can specify dynamic port forwarding in the configuration file.