0,frp 是一个可用于内网穿透的高性能的反向代理应用,支持 tcp, udp 协议,为 http 和 https 应用协议提供了额外的能力,且尝试性支持了点对点穿透。
1, 下载项目到本地
项目git地址: https://github.com/fatedier/frp

根据自己的系统和cpu架构来选择下载版本,我这里下载的是linux-amd64的包
2, 配置服务器端
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| [root@stark ~] [root@stark opt] frp_0.32.1_linux_amd64.tar.gz [root@stark opt] [root@stark opt] [root@stark opt] [root@stark frp] frpc frpc.toml frps frps.toml LICENSE
[root@stark frp] bindAddr = "0.0.0.0" bindPort = 7000 kcpBindPort = 7000 auth.method = "token" auth.token = "zhenpishafa" 置systemd管理** [root@stark frp] /opt/frp [root@stark frp] [Unit] Description=Frp Server Service After=network.target
[Service] Type=simple User=nobody Restart=on-failure RestartSec=5s ExecStart=/opt/frp/frps -c /opt/frp/frps.toml
[Install] WantedBy=multi-user.target
|
启动服务并加入开机自启
1 2 3 4 5
| [root@stark frp] [root@stark frp] [root@stark frp] [root@stark frp] Created symlink from /etc/systemd/system/multi-user.target.wants/frps.service to /usr/lib/systemd/system/frps.service.
|

3, 配置客户端
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| [root@stark-001 opt] [root@stark-001 opt] [root@stark-001 frp] frpc frpc.toml frps frps.toml LICENSE
[root@stark-001 frp] user = "tony" serverAddr = "1.2.3.4" serverPort = 7000 loginFailExit = true auth.method = "token" auth.token = "zhenpishafa" [[proxies]] name = "ssh" type = "tcp" localIP = "127.0.0.1" localPort = 22 remotePort = 7022
|
配置systemd管理
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| [root@stark-001 frp] /opt/frp [root@stark-001 frp] [Unit] Description=Frp Client Service After=network.target
[Service] Type=simple User=nobody Restart=on-failure RestartSec=5s ExecStart=/opt/frp/frpc -c /opt/frp/frpc.toml
[Install] WantedBy=multi-user.target
|
启动服务并加入开机自启
1 2 3 4 5 6
| [root@stark-001 frp] /opt/frp [root@stark-001 frp] [root@stark-001 frp] [root@stark-001 frp] [root@stark-001 frp]
|

启动成功之后会在服务端监听对应端口,一定要确保服务端端口是对外开放的!

4, 效果验证`
下面我们使用第三方服务器测试,来保证实验真实性。


速度测试
同样使用第三方Windows服务器


经过测试,带宽差不多有10M!这个速度对于内网穿透来说已经很不错了!