适用版本: frp_0.52.3
服务端
frps.toml
bindPort = 7000 auth.token = "TOKEN" log.to = "/var/log/frp/log" allowPorts = [ { single = 3389 }, { start = 9000, end = 9999 } ] webServer.addr = "0.0.0.0" webServer.port = 7500 webServer.user = "man" webServer.password = "srcret"
添加为服务 /etc/systemd/system/frpd.service
[Unit] Description = frp server After = network.target syslog.target Wants = network.target [Service] Type = simple ExecStart = /usr/sbin/frpd -c /etc/frp/frps.toml Restart=always [Install] WantedBy = multi-user.target
客户端
Windows:
frpc.toml
serverAddr = "106.13.232.33" serverPort = 7000 auth.token = "TOKEN" webServer.addr = "127.0.0.1" webServer.port = 7400 [[proxies]] name = "ua.workstation.rdp" type = "tcp" localIp = "127.0.0.1" localPort = 3389 remotePort = 9833
用nssm添加为服务
nssm install frpc P:\Applications\frp\frpc.exe "-c P:\Applications\frp\frpc.toml" # nssm install <servicename> <app> [<args> ...] # nssm install frpc # 打开 GUI
macOS:
frpc.toml
serverAddr = "106.13.232.33" serverPort = 7000 auth.token = "TOKEN" webServer.addr = "127.0.0.1" webServer.port = 7400 [[proxies]] name = "ua.workstation.vnc" type = "tcp" localIp = "127.0.0.1" localPort = 5900 remotePort = 9005
安装为服务:
sudo vi ~/Library/LaunchAgents/frpc.plist sudo launchctl load -w ~/Library/LaunchAgents/frpc.plist
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd> <plist version="1.0"> <dict> <key>Label</key> <string>frpc</string> <key>ProgramArguments</key> <array> <string>/Users/user/.frp/frpc</string> <string>-c</string> <string>/Users/user/.frp/frpc.toml</string> </array> <key>KeepAlive</key> <true/> <key>RunAtLoad</key> <true/> </dict> </plist>
注意事项
服务端要在防火墙中开放 serverPort、remotePort (不要忘记运营商的云防火墙),frps 会生成子进程监听 remotePort。
firewall-cmd --add-port=9000-9999/tcp --permanent firewall-cmd --reload
5900 TCP 控制和观察 5900 UDP 发送屏幕、共享屏幕 3283 TCP 报告 3283 UDP 附加数据 22 TCP 加密的文件传输、观察和控制(使用 SSH 隧道)
Windows 为 RDP 协议,默认端口 3389,macOS 为 VNC 协议,默认端口 5900,macOS 中根据共享内容不同可能是 UDP 协议而不是 TCP 协议。