Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »


개요

SSH Client 는 SSH Server 에 연결하는 용도외에 Port Forwarding 기능을 사용해서 Protocol tunneling 용도로도 사용할 수 있습니다.


예로 A(PC) <---------> B(Server) <------------------------> C(Server) 의 구조의 서버가 있을때 A 에서 B 로는 들어가지만 C 로는 못 들어갈 경우가 있습니다.

B 에서 C 로 연결이 가능하고 B 에 SSH 서버가 설치되어 있다면 SSH 의 port forwarding 기능을 사용하여 A 에서 B를 통해 C 로 우회 연결이 가능합니다.


SSH port forwarding 기능을 사용하려면 먼저 SSH client 를 설치해야 하며 OS X 나 Linux 는 보통 기본적으로 설치되어 있습니다.

Windows 사용자는 Windows 에 OpenSSH 설치 를 참고해서 설치하면 됩니다.

SSH tunneling

PC 가 있고 ssh-server(예: 192.168.10.20) 라는 서버가 있을 경우 다음 명령어로 모든 연결 요청을 

SSH Client 설정

 ssh -D 8123 -f -C -q -N ssh-server


  • -D : -D [bind_address:]port

                 Specifies a local “dynamic” application-level port forwarding.  This works by allocating
                 a socket to listen to port on the local side, optionally bound to the specified
                 bind_address.  Whenever a connection is made to this port, the connection is forwarded
                 over the secure channel, and the application protocol is then used to determine where to
                 connect to from the remote machine.  Currently the SOCKS4 and SOCKS5 protocols are sup‐
                 ported, and ssh will act as a SOCKS server.  Only root can forward privileged ports.
                 Dynamic port forwardings can also be specified in the configuration file.

                 IPv6 addresses can be specified by enclosing the address in square brackets.  Only the
                 superuser can forward privileged ports.  By default, the local port is bound in accor‐
                 dance with the GatewayPorts setting.  However, an explicit bind_address may be used to
                 bind the connection to a specific address.  The bind_address of “localhost” indicates
                 that the listening port be bound for local use only, while an empty address or ‘*’ indi‐
                 cates that the port should be available from all interfaces.

  • -f:     Requests ssh to go to background just before command execution.  This is useful if ssh

                 is going to ask for passwords or passphrases, but the user wants it in the background.
                 This implies -n.  The recommended way to start X11 programs at a remote site is with
                 something like ssh -f host xterm.

                 If the ExitOnForwardFailure configuration option is set to “yes”, then a client started
                 with -f will wait for all remote port forwards to be successfully established before
                 placing itself in the background.

  • -C:     Requests compression of all data (including stdin, stdout, stderr, and data for for‐
                 warded X11, TCP and UNIX-domain connections).  The compression algorithm is the same
                 used by gzip(1).  Compression is desirable on modem lines and other slow connections,
                 but will only slow down things on fast networks.  The default value can be set on a
                 host-by-host basis in the configuration files; see the Compression option.
  • -q:  Quiet mode.  Causes most warning and diagnostic messages to be suppressed.
  • -N:  Do not execute a remote command.  This is useful for just forwarding ports.


Browser 설정

웹 브라우저 설정

파이어폭스 설정


Chrome

설정 에서 proxy 를 입력하고 프록시 설정 화면에 들어갑니다.


수동 프록시 설정에서 주소에 127.0.01 을 입력하고 포트에 SSH 를 실행할때 지정한 포트(예: 812) 을 입력합니다.


저장을 누른후에 브라우저가 정상 작동하는지 확인합니다.


같이 보기

Ref

  • No labels