frp
frp
- 系列文章目录
- 前言
- 一、frp安装
- 二、服务端
- 1.systemd服务
- 2.启动frps
- 三、客户端
- 四、报错
- 参考
前言
内网穿透,内网通过公网 IP 中转暴露到公网
一、frp安装
wget https://github.com/fatedier/frp/releases/download/v0.43.0/frp_0.43.0_linux_amd64.tar.gz
# tar -zxvf frp_0.43.0_linux_amd64.tar.gz # mv frp_0.43.0_linux_amd64 frp二、服务端 1.systemd服务
vim /etc/systemd/system/frps.service
[Unit] # 服务名称,可自定义 Description = frp server After = network.target syslog.target Wants = network.target [Service] Type = simple # 启动frps的命令,需修改为您的frps的安装路径 ExecStart = /root/frp/frps -c /root/frp/frps.ini [Install] WantedBy = multi-user.target2.启动frps
# 启动frp systemctl start frps # 停止frp systemctl stop frps # 重启frp systemctl restart frps # 查看frp状态 systemctl status frps # 配置 frps 开机自启 systemctl enable frps三、客户端
vim /lib/systemd/system/frpc.service
[Unit] Description=FRP Client Daemon After=network-online.target [Service] ExecStart=/root/frp/frpc -c /root/frp/frpc.ini Restart=always RestartSec=20s [Install] WantedBy=multi-user.target
cat /root/frp/frpc.ini
[common] server_addr = x.x.x.x server_port = 7000 [ssh] type = tcp local_ip = 127.0.0.1 local_port = 22 remote_port = 6000
公网 IP 为 x.x.x.x local_ip 和 local_port 配置为本地需要暴露到公网的服务地址和端口。 remote_port 表示在 frp 服务端监听的端口
# systemctl daemon-reload # systemctl enable frpc.service # systemctl restart frpc.service # systemctl status frpc.service四、报错
- 报错为客户端和服务端版本不一致
# ./frpc -c ./frpc.ini [W] [service.go:128] login to server failed: EOF EOF
参考
- ffrp文档



