ssh tunneling
ssh tunnel을 통해서 port forwarding 하는 기술이다.
- 종류
- -L: local (target port의 내용을 local port로 forwarding)
- 즉 local에서 target에 접근이 가능
- -R: remote (local port의 내용을 target port로 forwarding)
- 즉 target에서 local에 접근이 가능
- -D: dynamic (ssh 서버를 proxy로 사용)
- -L: local (target port의 내용을 local port로 forwarding)
ssh -L {LOCAL_PORT}:{TARGET_IP}:{TARGET_PORT} {USER}@{SSH_IP}
ssh -R {LOCAL_PORT}:{TARGET_IP}:{TARGET_PORT} {USER}@{SSH_IP}
ssh -D {PORT} {USER}@{SSH_IP}
# ex) 컴퓨터의 5433 포트와 ip 1.2.3.4의 5432 포트를 연결
# 이렇게 하면 내 컴퓨터에서 5433로 postgresql db를 사용가능
ssh -L 5433:localhost:5432 [email protected]