logoSpectreAlan's blogs
自建frp内网穿透服务
标签:
Linux
服务器
frp
内网穿透
类别:服务器
创建时间: 2022-02-15 16:27:25
字数总计: 1.62 k
建议阅读时长: 2 分钟
阅读量: 936

服务端配置

下载&解压frp

1cd /home 2wget https://github.com/fatedier/frp/releases/download/v0.32.1/frp_0.32.1_linux_amd64.tar.gz 3# 解压 4tar -xzf frp_0.32.1_linux_amd64.tar.gz 5# 配置 6cd frp_0.32.1_linux_amd64

修改配置frps.ini

1[common] 2bind_port = 7000 3kcp_bind_port = 7000 4tls_enable = true 5token = e12adc3959ba59babe76e057f40f883b 6# 面板配置 7dashboard_port = 7500 8dashboard_user = admin 9dashboard_pwd = password 10# 日志文件 11log_file = ./frps.log 12# 记录的日志级别 13log_level = info 14# 日志留存3天 15log_max_days = 3 16# 超时时间 17authentication_timeout = 0 18# 最大链接池,每个代理预先与后端服务器建立起指定数量的最大链接数 19max_pool_count = 50

安装 systemd

1# yum 2yum install systemd 3# apt 4apt install systemd

创建并编辑 frps.service 文件

vi /etc/systemd/system/frps.service
1[Unit] 2# 服务名称,可自定义 3Description = frp server 4After = network.target syslog.target 5Wants = network.target 6 7[Service] 8Type = simple 9# 启动frps的命令,需修改为您的frps的安装路径 10ExecStart = /home/frp_0.32.1_linux_amd64/frps -c /home/frp_0.32.1_linux_amd64/frps.ini 11 12[Install] 13WantedBy = multi-user.target

使用 systemd 命令,管理 frps

1# 启动frp 2systemctl start frps 3# 停止frp 4systemctl stop frps 5# 重启frp 6systemctl restart frps 7# 查看frp状态 8systemctl status frps

开机自启

systemctl enable frps

客户端配置

安装

安装步骤同frps

修改配置frpc.ini

1[common] 2server_addr = xx.xx.xx.xx 3server_port = 7000 4tls_enable = true 5tcp_mux = false 6token = e12adc3959ba59babe76e057f40f883b 7 8[ssh] 9type = tcp 10local_ip = 127.0.0.1 11local_port = 22 12remote_port = 6000 13 14[tomcat] 15type = http 16local_ip = 127.0.0.1 17local_port = 8080 18remote_port = 8080
吐槽一下
copyright