wget https://github.com/fatedier/frp/releases/download/v0.22.0/frp_0.22.0_linux_amd64.tar.gz
下载完成后解压文件
tar -xzvf frp_0.22.0_linux_amd64.tar.gz
在解压的文件中找到frps.ini(server配置文件)[common]
bind_port = 7000
以上配置即可启动,需要注意的是保证上方配置的端口未被其他应用使用./frps -c ./frps.ini
看到success字样即启动成功。注意当前窗口不能关闭,如果需要后台启动,则命令为:
nohup ./frps -c frps.ini >/dev/null 2>&1 &
wget https://github.com/fatedier/frp/releases/download/v0.22.0/frp_0.22.0_linux_amd64.tar.gz
下载完成后解压文件
tar -xzvf frp_0.22.0_linux_amd64.tar.gz
在解压的文件中找到frpc.ini(client配置文件)[common]
#有公网IP的主机的公网IP地址,也可以配置域名
server_addr = x.x.x.x
#frp 服务端的端口,必须与server一致
server_port = 7000
[testtcp]
type = tcp
local_ip = 127.0.0.1
local_port = 3306
remote_port = 6000
上面的配置为,将本地的3306 TCP协议端口转发至公网主机的6000端口。需要注意的是保证公网主机的6000端口未被使用
[common]
bind_port = 7000
token=abab123456
[common]
#有公网IP的主机的公网IP地址,也可以配置域名
server_addr = x.x.x.x
#frp 服务端的端口,必须与server一致
server_port = 7000
#必须与server配置一直才能通过认证
token=abab123456
[testtcp]
type = tcp
local_ip = 127.0.0.1
local_port = 3306
remote_port = 6000
注意:客户端节点名称必须唯一,也就是说其他电脑链接到当前服务端用了[testtcp]则这里旧必须改个,改成比如[testtcp-2]
启动frp client
./frpc -c ./frpc.ini
看到success字样即启动成功。注意当前窗口不能关闭,如果需要后台启动,则命令为:
nohup ./frpc -c frpc.ini >/dev/null 2>&1 &
[common]
server_addr = *.*.*.* #已安装好frp服务端frps的服务器Ip地址
server_port = 5443 #与之前frp服务端的设置保持一致,即Bind Port
token = ************** #与之前安装服务端时给出的token保持一致
[web1]
type = http
local_ip = 192.168.1.1 #表示要穿透的为路由器IP
local_port = 80
use_encryption = true
use_gzip = true
custom_domains = *.*.* #表示远程访问192.168.1.1需要的域名,可以为二级域名。如果没有域名建议提前申请,并指向服务器所在IP
http_user = *** #可选项,随便填写,表示访问域名时需要用这个用户名验证通过后,才能连接到内网,加了一道防护,更安全
http_pwd = ****** #可选项,随便填写,同上,用户名对应这个密码,输入正确才能连接到内网
[web2]
type = http
local_ip = 192.168.1.111 #按需填写,填写需要远程访问的第二个内网设备IP
local_port = 80
use_encryption = true
use_gzip = true
custom_domains = *.*.* #表示远程访问192.168.1.111需要的域名,需要与上文的域名有所区别
http_user = *** #可选项,用户名
http_pwd = ****** #可选项,用户密码
log_file = /dev/null
log_level = info
log_max_days = 3
https://www.leftso.com/article/548.html