SSH Tunneling

From HPCWIKI
Jump to navigation Jump to search

Template:Status

Template:TOC

Overview

SSH Tunneling에 대한 기술 문서입니다.

Summary

  • 무엇인가? - SSH Tunneling
  • 왜 필요한가? - HPC 및 서버 환경에서 필수 개념
  • 언제 사용하는가? - 서버 구성, 성능 튜닝, 문제 해결 시


Purpose

이 문서가 존재하는 이유

  • Goal: SSH Tunneling에 대한 기술 정보 제공
  • Scope: SSH Tunneling의 개념, 사용법, 설정
  • Non-goals: 다른 주제로의 확장


Key Concepts

Concept Description Related
SSH Tunneling HPC/서버 환경에서 중요한 기술 개념 Linux, Server


Detailed Explanation

SSH port forwarding (often referred to as SSH tunneling) is a mechanism in SSH for tunneling application ports from the client to the server, or servers to clients. It can be used for adding encryption to legacy applications, going through firewalls, and some system administrators and IT professionals use it for opening backdoors into the internal network.[1] including default SSH port (22), binding listening ports under 1024, by default, requires root privileges.

Using OpenSSH in Linux we can enable local, remote, or dynamic SSH port forwarding between client and server. more detailed guide can be found at phoenixnap and audviklabs.

#Local Port Forwarding with OpenSSH, 
#Expose a local service to the intranet via internal SSHD
ssh -L ACL_IP:local_port:destination_server_ip:destination_server_port user@ssh_server
#without ACL_IP(0.0.0.0) only locahost host 127.0.0.1 can be accessable. you can check netstat command
example : ssh -L 0.0.0.0:4321:10.211.55.21:22 user@10.211.55.21 -N 
Redirect all trafic on 4321 port to 10.211.55.21 port 22 for SSH connection, -N means do not execute this command on the shell
#Remote Port Forwarding with OpenSSH
#Expose a local service to the outside world via public accessable gateway.
ssh -R remote_port:localhost:local_port ssh_gateway_server
#Dynamic Port Forwarding with OpenSSH
ssh –D local_port ssh_server_hostname
Multiple Tunnels and Multiple Host Hopping
ssh -X -L 5432:<DB server IP>:5432 -R 873:<local RSYNC server>:873
  • SSH tunnels to reach farther SSH servers
ssh -L 8022:<server2>:22 user@server1
ssh -L 8023:<server3>:22 -p 8022 user@server2


Best Practices

  • 최신 버전 사용 권장
  • 공식 문서 참고
  • 테스트 환경에서 먼저 검증


References


Related Pages

Knowledge Graph

Related

LinuxServerHardwareNetwork