frp配置
从https://github.com/fatedier/frp下载最新版本。
解压安装:
tar -zxvf frp_0.55.1_linux_amd64.tar.gz
配置服务器端的配置文件:frps.toml
bindPort = 7000
webServer.addr = "0.0.0.0"
webServer.port = 7500
webServer.user = "admin"
webServer.password = "123456"
auth.method = "token"
auth.token = "123456"
配置客户端配置文件:
serverAddr = "服务器地址"
serverPort = 7000
auth.method = "token"
auth.token = "123456"
webServer.addr = "客户端地址"
webServer.port = 7400
webServer.user = "admin"
webServer.password = "admin"
[[proxies]]
name = "server22_remote"
type = "tcp"
localIP = "客户端地址"
localPort = 22
remotePort = 6001
[[proxies]]
name = "server22_jenkins_web"
type = "tcp"
localIP = "客户端地址"
localPort = 50000
remotePort = 50000
[[proxies]]
name = "server22_jenkins"
type = "tcp"
localIP = "客户端地址"
localPort = 8080
remotePort = 8080
设置自启动,创建/etc/systemd/system/frps.service文件并设置:
[Unit]
Description=Frp Server
After=syslog.target network.target
Wants=network.target
[Service]
Type=simple
ExecStart=/home/frp/frp_0.55.1_linux_amd64/frps -c /home/frp/frp_0.55.1_linux_amd64/frps.toml
ExecStop=/usr/bin/killall frps
RestartSec=1min
KillMode=control-group
Restart=always
[Install]
WantedBy=multi-user.target
然后执行命令:
sudo systemctl enable frps.service
sudo systemctl start frps.service
这样子,frpc.service 便会自行启动
输入
sudo systemctl status frps.service
查看运行情况。
客户端是frpc