Server/Linux

Linux SSH Tunneling

로아_ 2023. 3. 29. 13:35
728x90

Linux SSH Tunneling 

공인아이피가 없는 외부접근이 안되는 컴퓨터를 외부접근이 가능한 서버로 연결

[ssh설정]

$ sudo nano /etc/ssh/sshd_config

AllowTcpForwarding yes
GatewayPorts yes

ssh 재시작
$ sudo systemctl restart sshd

[iptables 방화벽 해제]

sudo iptables -I INPUT -p tcp --dport 8080 -j ACCEPT

[예제]

예) 기숙사에 인는 컴퓨터에 접근하고 싶다.

A : 기숙사 컴퓨터 (인터넷은 되나 외부 연결이 안되어 있다.)

B : 외부접근이 가능한 서버 (아이피 : 1.1.1.1 임시설명을 위해)

 

1.1.1.1:8080 으로접근하면 A 컴퓨터의 8080으로 연결해준다.

ssh -i D:\dev\ssh\ocl\oracleCloudOpenSsh.ppk ubuntu@ksmcloud.duckdns.org -R 8080:localhost:8080

 

 

728x90