TeamViewer要付費,向日葵高峰期慢的要死,AnyDesk、GoDesk又慢又不穩定,總之不付費白嫖是不可能爽的。剛好有台閑置的2M服務器,配合使用frp做內網穿透,實現3389遠程連接內網機器。
https://github.com/fatedier/frp
場景
1,一台具有固定公網IP的機器[server],linux/windows都行
2,一台Win10常用機[client],公網IP不固定
期望
能通過mstsc遠程連接client
實現
1.部署服務端frps
server機器通過docker安裝更簡單,https://hub.docker.com/r/snowdreamtech/frps
docker run --restart=always --network host -d -v /etc/frp/frps.ini:/etc/frp/frps.ini --name frps snowdreamtech/frps
2.配置frps.ini
完整文檔:https://gofrp.org/docs/
以下用到的7000,7500,7001端口可自行定義且需開放。
[common]
bind_port = 7000 #服務端監聽端口,接收frpc的連接
token = tT52****n9Q8 #用於鑒權,客戶端(frpc)需要設置一樣的值才能鑒權通過
#Dashboard, 監控面板
dashboard_port = 7500
dashboard_user = admin
dashboard_pwd = ******
配好之后需要重新加載或者直接restart容器,然后通過http://server公網IP:dashboard_port 可以訪問監控面板。
3.部署客戶端frpc
通過Github的Release頁面下載windows版本的壓縮包,客戶端只需要用到frpc.exe和frpc.ini兩個文件(會被windows防火牆當成病毒殺掉)
4.配置frpc.ini
[common]
server_addr = xx.xxx.xx.x #server的公網IP
server_port = 7000 #服務端的監聽端口
token = tT52****n9Q8 #和服務端對應
[rdp-mf]
local_port=3389 #本地端口,遠程桌面默認3389
remote_port=7001 #對外開放的端口,使用服務器IP:remote_port連接到內網機器
5.啟動frpc
打開cmd,切到frpc.exe所在目錄 執行frpc.exe -c frpc.ini
C:\Users\admin>d:
D:\>cd D:\Program Files (x86)\frp_0.34.2_windows_amd64
D:\Program Files (x86)\frp_0.34.2_windows_amd64>frpc.exe -c frpc.ini
配置完成,在另一台通過server公網IP:7001即可遠程client