frp内网穿透设置

下载地址

文档说明

frps设置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
bindPort = 7000 #{必选} 客户端与该端口建立连接,默认设置700      
vhostHTTPPort = 80
vhostHTTPSPort = 443

#身份验证
#auth.method = "token" #{可选}身份验证方式
#auth.token = "bT22222aaafff" #token设置密码,用于通过身份验证创建连接

#frp服务仪表板配置

webServer.port = 6950 #{也可自行修改端口}
webServer.addr = "0.0.0.0" #公网ip或者域名
webServer.user = "admin" #登录用户名{可自行修改}
webServer.password = "admin" #登录密码{可自行修改}

运行

  • 在frp目录下运行 frps.exe -c frps.toml
1
2
3
4
5
6
2024-03-26 15:04:00.500 [I] [frps/root.go:105] frps uses config file: frps.toml
2024-03-26 15:04:00.832 [I] [server/service.go:237] frps tcp listen on 0.0.0.0:7000
2024-03-26 15:04:00.832 [I] [server/service.go:304] http service listen on 0.0.0.0:80
2024-03-26 15:04:00.833 [I] [server/service.go:318] https service listen on 0.0.0.0:443
2024-03-26 15:04:00.833 [I] [frps/root.go:114] frps started successfully
2024-03-26 15:04:00.833 [I] [server/service.go:350] dashboard listen on 0.0.0.0:6950
  • 运行成功界面

客户端

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
serverAddr = "XXXXXXX"  #{IP地址}     
serverPort = 7000 #端口号,与服务器一样

[[proxies]]
name = "test-tcp"
type = "tcp"
localIP = "127.0.0.1"
localPort = 22
remotePort = 5678

[[proxies]]
name = "test-tcp-2"
type = "tcp"
localIP = "127.0.0.1"
localPort = 3389
remotePort = 4567

  • 隐藏cmd窗口 且 运行 frpc.exe -c frpc.toml
1
2
3
4
5
6
%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit cd /d "%~dp0"
if "%1"=="hide" goto CmdBegin
start mshta vbscript:createobject("wscript.shell").run("""%~0"" hide",0)(window.close)&&exit
:CmdBegin

cd /d D:\frp\frp_0.56.0_windows_amd64\frp_0.56.0_windows_amd64 && frpc.exe -c frpc.toml
  • 添加到启动项(将bat文件移动到目录下)
1
C:\Users\zhouwenxi\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

注意

  • 开放防火墙端口,以及服务器安全组端口
  • frps及frp可能会被360等软件检测出病毒文件,设置为信任即可