본문 바로가기
Tools

ngrok - local PC에 접속하기

by wycho 2021. 12. 27.

 

Local PC에서 작업한 내용을 외부에서 확인하거나 시연을 해야할 상황이 있을 경우, IP가 외부접속이 불가능할 경우 이것을 우회하여 접속하는 방법을 소개한다.

 

- Homepage : https://ngrok.com/

- Download : https://ngrok.com/download

- Tokenkey : https://dashboard.ngrok.com/get-started/your-authtoken

- 세션상태확인 : http://127.0.0.1:4040

 

 

$ curl -s https://ngrok-agent.s3.amazonaws.com/ngrok.asc | sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null && echo "deb https://ngrok-agent.s3.amazonaws.com buster main" | sudo tee /etc/apt/sources.list.d/ngrok.list && sudo apt update && sudo apt install ngrok
$ ngrok config add-authtoken token_hash
$ ngrok tcp 3389 ## Remote desktop

 

$ sudo vi /etc/ssh/sshd_config
PasswordAuthentication yes
ChallengeResponseAuthentication to yes

$ sudo /etc/init.d/ssh restart
$ sudo /etc/init.d/ssh start

$ sudo tar xvzf ~/Downloads/ngrok-stable-linux-amd64.tgz -C /usr/local/bin
$ ngrok authtoken tokenkey_from_ngrok
$ ngrok http port_num # 연결을 원하는 web port
$ ngrok tcp 22 # SSH 연결
----
Forwarding                    tcp://0.tcp.ngrok.io:1037 -> localhost:22
----
# connection
$ ssh userid@0.tcp.ngrok.io -p 1037

# options
-auth='user:passwd' # 접속시 아이디와 비번입력해야 사용가능
-region jp # tunneling 지역선택

tokenkey 인증하지 않아도 8시간동안 사용이 가능하다.

 

무료로 사용하면 domain 주소가 random으로 생성되지만, 제공되는 서비스는 충분히 편리하다.

 

 

 

 

'Tools' 카테고리의 다른 글

Methylcheck  (0) 2022.01.20
Methylprep  (0) 2022.01.19
Combine files  (0) 2021.12.03
Heroku - App publication  (0) 2021.12.02
WEB-based analysis  (0) 2021.11.30

댓글