frp内网穿透
frp功能强大,无与伦比
官方地址里面有全面的说明https://github.com/fatedier/frp
1 下载解压免安装
https://github.com/fatedier/frp/releases
wget https://github.com/fatedier/frp/releases/download/v0.48.0/frp_0.48.0_linux_amd64.tar.gz
tar zxf frp_0.48.0_linux_amd64.tar.gz
mv frp_0.48.0_linux_amd64 /opt/frp
2 frps配置示例
以下示例,可以根据需要部分开启
[common]
bind_port = 7000
## QUIC、KCP 二选一:
# 开启QUIC(udp协议),bind_port是tcp的
#quic_bind_port = 7000
# 开启KCP(udp协议),有点节省带宽,速度快
#kcp_bind_port = 7000
# TCP流多路复用
tcp_mux = true
# 验证
authentication_method = token
token = 98f0feiffjeeeeeeeeeeeeee
# frps 管理 dashboard
dashboard_port = 7500
dashboard_user = admin
dashboard_pwd = admin1
# ==========================
# 以下根据需要开启
# http https 端口可以一样,他会自动侦测
vhost_http_port = 8080
vhost_https_port = 4343
# 父域名
subdomain_host = frps.example.com
3 frpc配置示例
以下示例,可以根据需要部分开启。以下演示了 type = 【tcp、udp、http、https】基本用法,详细还得看官方说明https://github.com/fatedier/frp
[common]
# frps的地址与端口
server_addr = 120.5.5.5
server_port = 7000
## QUIC、KCP 二选一:
# 使用QUIC(udp协议),默认tcp,端口也是使用server_port指定
#protocol = quic
# 使用KCP(udp协议),默认tcp,端口也是使用server_port指定
#protocol = kcp
# TCP流多路复用
tcp_mux = true
# 验证
authentication_method = token
token = 98f0feiffjeeeeeeeeeeeeee
# frpc 管理
admin_addr = 127.0.0.1
admin_port = 7400
admin_user = admin
admin_pwd = admin2222
# ==========================
# 以下根据需要开启
[tcp-stag-trav-ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 22221
# 带宽限制
bandwidth_limit = 10MB
[tcp-stag-trav-pg]
type = tcp
local_ip = 10.1.211.55
local_port = 5432
remote_port = 25421
# 带宽限制
bandwidth_limit = 10MB
[udp-stag-trav-dns]
type = udp
local_ip = 8.8.8.8
local_port = 53
remote_port = 25301
# subdomain方式
[http-web-x]
# http配合frps的vhost_http_port使用
type = http
local_port = 9727
# 可以使用ip或域名
local_ip = 127.0.0.1
# 子域名,与subdomain_host配对使用(stag-gan-api.frps.example.com)
subdomain = stag-gan-api
#locations = /news,/about
#http_user = abc
#http_pwd = cdef
# custom_domains方式
[http-web-y]
# http配合frps的vhost_http_port使用
type = http
local_port = 80
# 可以使用ip或域名
local_ip = www.baidu.com
# 指定完整域名
custom_domains = y.example.com
#locations = /news,/about
# https
[https-web-z]
# https配合frps的vhost_https_port使用
type = https
local_port = 443
custom_domains = z.example.com
# 支持v1 v2
proxy_protocol_version = v2
4 启动
4.1 frps
nohup /opt/frp/frps -c ./frps.ini >> /opt/frp/frps.log 2>&1 &
查看日志tail -f /opt/frp/frps.log
管理地址http://ip或fqdn:7500
4.1 frpc
nohup /opt/frp/frpc -c ./frpc.ini >> /opt/frp/frpc.log 2>&1 &
查看日志tail -f /opt/frp/frpc.log
管理地址http://ip或fqdn:7400
,
或者使用命令/opt/frp/frpc status -c /opt/frp/frpc.ini
查看frpc状态
5 最后
爱你