frp内网穿透软件安装

本文详细介绍了如何在CentOS服务器上安装和配置FRP内网穿透软件,包括服务端和客户端的安装步骤,以及如何进行环境设置、系统集成和配置参数,以便于通过公网访问内网服务。
摘要由CSDN通过智能技术生成

frp内网穿透软件安装

一、FRP简介

​ frp 是一个专注于内网穿透的高性能的反向代理应用,支持 TCP、UDP、HTTP、HTTPS 等多种协议。可以将内网服务以安全、便捷的方式通过具有公网 IP 节点的中转暴露到公网。简单来说白嫖版花生壳,不过需要公网IP。

二、环境

​ 1、一个有公网IP环境的服务器或者pc电脑,本文以centos服务器为例

​ 2、可以访问到服务器的内网服务器或者pc电脑,本文以centos系统为例

三、安装

# 服务端操作
## 下载并解压
~]# wget https://github.com/fatedier/frp/releases/download/v0.54.0/frp_0.54.0_linux_amd64.tar.gz
~]# tar -xf frp_0.54.0_linux_amd64.tar.gz -C /usr/local/
~]# mv /usr/local/frp_0.54.0_linux_amd64 /usr/local/frps
## systemd管理]# cat /usr/lib/systemd/system/frps.service 
[Unit]
Description=The nginx HTTP and reverse proxy server
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=simple
ExecStart=/usr/local/frps/frps -c /usr/local/frps/frps.toml
KillSignal=SIGQUIT
TimeoutStopSec=5
KillMode=process
PrivateTmp=true
StandardOutput=syslog
StandardError=inherit

[Install]
WantedBy=multi-user.target
### 启停操作
~]# systemctl deamon-reload
~]# systemctl start frps
~]# systemctl stop frps
~]# systemctl restart frps
~]# systemctl status frps
~]# systemctl enable frps
~]# systemctl disable frps


# 客户端操作
## 下载并解压
~]# wget https://github.com/fatedier/frp/releases/download/v0.54.0/frp_0.54.0_linux_amd64.tar.gz
~]# tar -xf frp_0.54.0_linux_amd64.tar.gz -C /usr/local/
~]# mv /usr/local/frp_0.54.0_linux_amd64 /usr/local/frps
## systemd管理]# cat /usr/lib/systemd/system/frpc.service 
[Unit]
Description=The nginx HTTP and reverse proxy server
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=simple
ExecStart=/usr/local/frps/frpc -c /usr/local/frps/frpc.toml  
KillSignal=SIGQUIT
TimeoutStopSec=5
KillMode=process
PrivateTmp=true
StandardOutput=syslog
StandardError=inherit

[Install]
WantedBy=multi-user.target

四、配置

# 服务端
~]# cat frps.toml
[common] #必须设置
bind_port = 7000 #是自己设定的frp服务端端口
vhost_http_port = 80 #是自己设定的http访问端口
token = 123  #核实身份用,加了更安全

[ssh] #ssh反向代理(不是必须设置)
listen_port = 6000 是自己设定的ssh访问端口

[web] #http反向代理[]里的内容可以自己设定,但是客户端和服务端必须要对应(如[aaa],[bbb]);
type = http #为服务类型,可以设为http,https
custom_domains = test1.a.com #为要映射的域名,记得域名的A记录要解析到外网主机的IP。

[web2] #同上(可设置多个)

# 客户端
~]# cat frpc.toml
[common]
server_addr = 远程frp服务器ip
server_port = 7000 远程frp服务器端口
token = 123 远程frp服务器token

[ssh] #ssh反向代理
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 6000 # 和服务端设置一致

[web]
type = http
local_ip = 127.0.0.1
local_port = 80 # 本地端口号
remote_port = 8080 # 远程frp服务器的http服务端口号
custom_domains = test1.a.com # 自定义配置的域名
subdomain = 匹配服务端配置的subdomain_host

五、启动

# 服务端
~]# systemctl restart frps
# 客户端
~]# systemctl restart frpc
## 在客户端中看见ssh和web 两个success即成功连接上了。这时候打开公网服务器的6000和8080端口即可通过公网ip访问到客户端主机的ssh和web服务
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值