A couple of solutions you can choose now:
1. Change your router / firewall configuration to do port forwarding or NAT from public to your application. But in many cases, you wont be able to make that changes or you even do not have that options.
2. Tunneling services : either self hosting or cloud services such as:
- Ngrok
- FRP
- Localtunnel
- Piggy
- Others
Ngrok
Setup & Installation
1. Download ngrok
ngrok is easy to install. Download a single binary with zero run-time dependencies. There are following versions available to download : Winodws, Mac OS X Linux Mac (32-bit) Windows (32-bit)Linux (ARM) Linux (32-bit) FreeBSD (64-Bit)FreeBSD (32-bit)
Note: Windows Ngrok is a command line tool. You will need to unzip it into a folder then use it from command line.
2. Unzip to install
$ unzip /path/to/ngrok.zip
3. Connect your account
$ ./ngrok authtoken ad7FeWDimD3GTj1Hqkh7_m3BRJfhTyqfiZbBV8dAJ
Following screenshots are captured from Windows OS.
Windows Command line ngrok commands |
Ngrok connection forwarding to localhost 3389 (Windows Remote Desktop Service) |
4. Fire it up
$ ./ngrok help
$ ./ngrok http 80
5. Expose a local webserver
$ ./ngrok http 80
$ ./ngrok start demo
authtoken: ad7FeWDimD3GTj1Hqkh7_m3BRJfhTyqfiZbBV8dAJ region: us console_ui: true web_addr: localhost:4040 tunnels: demo: proto: http addr: 9090 hostname: demo.mysite.com inspect: false auth: "demo:secret"
Youtube Video for all steps in Windows 7 :
FRP (Fast Reverse Proxy)
What is frp?
frp is a fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet. Now, it supports tcp, udp, http and https protocol when requests can be forwarded by domains to backward web services.
1. Deploy frps at server side.
cd wget https://github.com/fatedier/frp/releases/download/v0.21.0/frp_0.21.0_linux_amd64.tar.gz tar -xzvf frp_0.21.0_linux_amd64.tar.gz cd frp_0.21.0_linux_amd64
vi frps.ini
[common]
bind_port = 8000
token = 'your password'
./frps -c ./frps.ini
[root@testserver1 frp 0.21.0_1inux_amd64]# ./frps -c ./frps.ini 2018/11/25 19:20:00 [I] [service.go:130] frps tcp listen on 0.0.0.0:8000 2018/11/25 19:20:00 [I] root.:o:207 Start fris success
yum -y install screen screen -S frp ./frps -c ./frps.ini
- https://github.com/fatedier/frp/releases/download/v0.21.0/frp_0.21.0_windows_386.zip
- https://github.com/fatedier/frp/releases/download/v0.21.0/frp_0.21.0_windows_amd64.zip
[common] server_addr = server public IP server_port = 8000 token = "your password which is same as server side" [testssh] type = tcp local_ip = 127.0.0.1 local_port = 2222 remote_port = 16316
frpc.exe -c frpc.ini
$ ./frpc -c ./frpc.ini 2018/11/25 12:21:23 [I] [proxy_manager.go:284] proxy removed: [] 2018/01/25 12:21:23 [I] [proxy_manager.go:294] proxy added: [testssh] 2018/01/25 12:21:23 [I] [proxy_manager.go:317] visitor removed: [] 2018/01/25 12:21:23 [I] [proxy_manager.go:326] visitor added: [] 2018/01/25 12:21:23 [I] [control.go:240] [3b123131341cb] login to server success, get run id [3b123131341cb], server udp port [0] 2018/01/25 12:21:23 [I] [control.go:165] [3b123131341cb] [ssh] start proxy success
2018/08/14 19:29:14 [I] [service.go:319] client login info: ip[3b123131341cb] version [0.21.0] hostname [] os [windows] arch [amd64] 2018/08/14 19:29:14 [I] [service.go:217] [3b123131341cb] [testssh] tcp proxy listen port [16316] 2018/08/14 19:29:14 [I] [control.go:335] [3b123131341cb] new proxy [testssh] success
Localtunnel.me
Localtunnel allows you to easily share a web service on your local development machine without messing with DNS and firewall settings.
Localtunnel will assign you a unique publicly accessible url that will proxy all requests to your locally running webserver.
npm install -g localtunnel
lt --port 8000
Piggy
Pinggy is the easiest way to get public URLs for your localhost. You can use it to quickly host a website from your laptop, receive webhooks, share files, connect to your Raspberry Pi, and more.
Follow the three simple steps to get started:
Step 1: Run your service in localhost
First you need to run the service you want to share in localhost. For example you may be using a webserver like Apache. Make sure your service is available in a localhost URL such as http://localhost:8080.
You can quickly launch such a server for testing purposes using Python: python3 -m http.server
. This will start a server at http://localhost:8000.
Step 2: Create a tunnel using a single command
ssh -p 443 -R0:localhost:8000 a.pinggy.io
Replace the port 8000
with the localhost port where your service is running.
Step 3: Access through public URL
The above command will provide you http and https URLs as follows:
You can access local server via following URL(s):
http://fakqxzqrohxxx.a.pinggy.online
https://fakqxzqrohxxx.a.pinggy.online
You can access your localhost service using these URLs.
Other Tools
- TeamViewer: (可免费使用情况下,属于性能较好的解决方案, UAC穿透能力弱)
(tv 在 server 上要 licence,,而且 tv 最大的缺点是更新频繁,低版本高版本混用,闹心~在 win10 上也容易被 uac 卡住,,目前能穿透 uac 的,只有 xt800 了) - Anydesk
- Citrix gotomypc (面向企业级用户,无社区版,体验良好,微软的远程桌面功能mstsc一部分是向Citrix购买的)
- Gotoassist
- VNC
- PCAnywhere
- kdt
- xt800
- splashtop
- uvnc
- RealVNC
- 花生壳/向日葵: (Windows还行, Linux糟糕)
- SAKURA FRP:基于frp的免费内网穿透工具,也有收费服务。对于这家的行为,网民褒贬不一。如果你没有自己的服务器,可以尝试一下这家。
- V2ray:V2ray是一个功能强大的网络平台,提供代理、反向代理、内网穿透等功能。
- ZeroTier:号称零配置的内网穿透工具,提供与企业 SDN 交换机同等的高级网络虚拟化和管理功能,可以跨本地和广域网连接任何设备和程序。然而由于ZeroTier的服务器在国外,国内连接速度经常很感人,需要自行搭建Moon来解决;
- ngrok:ngrok 也是很知名的内网穿透工具,自从2.x版本不再开源,名气在下降。ngrok官网也提供免费穿透隧道,但国内连接速度较慢。NATAPP、Sunny-Ngrok等工具基于ngrok二次开发而来;
- NPS : a lightweight, high-performance, powerful intranet penetration proxy server, with a powerful web management terminal.
References
- https://news.ycombinator.com/item?id=7585056
- frp内网穿透,这个有大用处!
- https://github.com/fatedier/frp
- https://localtunnel.me
- https://ngrok.com/pricing
No comments:
Post a Comment