sword

frp配置推荐模板
说明【看不完整的按键盘向右】以下配置适合0.10.0~0.16.1版本frp客户端与服务端0.9.3及以下版本兼容...
扫描右侧二维码阅读全文
30
2018/01

frp配置推荐模板

说明

【看不完整的按键盘向右】
以下配置适合0.10.0~0.16.1版本
frp客户端与服务端0.9.3及以下版本兼容,0.10.0~0.16.1版本兼容,使用时需要注意
0.18.0以上版本把配置中的“privilege_”字段去掉即可

下例中使用的服务端freenat.bid为0.16.1版本,freenat.club为0.21.0版本

内网穿透交流群:912388232

1、frpc客户端

因为群晖需求端口比较多,这里以群晖穿透为例贴配置,其他同理。

[common]
server_addr = freenat.bid
#frps服务端地址
server_port = 7000
#frps服务端通讯端口,客户端连接到服务端内网穿透传输数据的端口
privilege_token = frp888
#特权模式密钥,客户端连接到FRPS服务端的验证密钥
log_file = frpc.log
#日志存放路径
log_level = info
#日志记录类别,可选:trace, debug, info, warn, error
log_max_days = 7
#日志保存天数
login_fail_exit = false
#设置为false,frpc连接frps失败后重连,默认为true不重连
protocol = kcp
#如连接报错,则去掉
#KCP协议在弱网环境下传输效率提升明显,但是对frps会有一些额外的流量消耗。服务端须先设置kcp_bind_port = 7000,freenat.bid服务端已设置支持

[http_dsm]
#穿透服务名称,不能和其他已建立的相同,使用公共服务器的建议修改成复杂一点的名称,避免与其他人冲突,很多路由器内置frpc的默认服务名称为[web],很容易很其他人冲突
type = http
#穿透协议类型,可选:tcp,udp,http,https,stcp,xtcp,这个设置之前必须自行搞清楚应该是什么
local_ip = 192.168.1.2
#本地监听IP,可以是本机IP,也可以是本地的局域网内某IP,例如你的局域网是互通的,你可以在路由器上安装frpc,然后local_ip填的群晖的ip,这样也可以把群晖穿透出去
local_port = 5000
#本地监听端口,通常有ssh端口22,远程桌面3389等等
use_compression = true
#对传输内容进行压缩,可以有效减小 frpc 与 frps 之间的网络流量,加快流量转发速度,但是会额外消耗一些 cpu 资源
use_encryption = true
#将 frpc 与 frps 之间的通信内容加密传输
custom_domains = dsm.freenat.bid
#自定义域名访问穿透服务,一般域名设置了二级域名泛解析以后,这里填*.freenat.bid即可,*自定义,如果不想用域名或者自行搭建frps没有域名,则穿透协议类型选择tcp,见以下tcp部分详解
#通过app访问群晖的注意,DS file,DS video,DS audio,DS finder里地址栏默认都是5000端口,穿透后地址栏须填写为【穿透域名:80】,DS photo由于本地local_port为80,穿透后也为80的话直接写域名地址即可

[https_dsm]
type = https
local_ip = 192.168.1.2
local_port = 5001
use_compression = true
use_encryption = true
custom_domains = dsm.freenat.bid
#以上https配置同http,群晖注意开启https(默认5001端口),证书在客户端即群晖端配置,无证书的注意浏览器访问时添加信任

[http_transmission]
type = http
local_ip = 192.168.1.2
local_port = 9091
use_compression = true
use_encryption = true
custom_domains = tr.freenat.bid
#transmission下载客户端

[http_rutorrent]
type = http
local_ip = 192.168.1.2
local_port = 80
use_compression = true
use_encryption = true
custom_domains = rt.freenat.bid
#rutorrent下载客户端,用Download Station的类似,注意端口


[http_blog]
type = http
local_ip = 192.168.1.2
local_port = 80
use_compression = true
use_encryption = true
custom_domains = blog.freenat.bid
#群晖里的web搭建的博客,怎么搭建百度去

[http_plex]
type = http
local_ip = 192.168.1.2
local_port = 32400
use_compression = true
use_encryption = true
custom_domains = plex.freenat.bid
#plex视频服务器,外面直接通过plex看群晖内视频

[https_feixun]
privilege_mode = true
type = http
local_ip = 192.168.1.1
#路由器ip
local_port = 80
use_compression = true
use_encryption = true
authentication_timeout = 0
custom_domains = feixun.freenat.bid
#穿透路由器


[tcp_ssh]
#群晖ssh连接
type = tcp
local_ip = 192.168.1.2
local_port = 22
use_compression = true
use_encryption = true
remote_port = 3463
#远程端口,一般tcp和udp需要设置,不需要设置custom_domain,访问时为【frps服务器地址+远程端口】,没有域名的用这种方式通过【frps服务器地址+远程端口】即可实现访问

[udp]
type = udp
local_ip = 192.168.1.2
local_port = 53
use_compression = true
use_encryption = true
remote_port = 3453
#访问时为【frps服务器地址+远程端口】

2、frps服务端

自行搭建服务端配置参考(必须有公网ip,但域名非必须)

详细搭建教程参考文章:frps服务端搭建教程

[common]
bind_addr = 0.0.0.0
#服务器IP,0.0.0.0为服务器全局所有IP可用,假如你的服务器有多个IP则可以这样做,或者填写为指定其中的一个服务器IP,支持IPV6
bind_port = 7000
#通讯端口,用于和客户端内网穿透传输数据的端口,可自定义
bind_udp_port = 7001
#UDP通讯端口,用于点对点内网穿透
kcp_bind_port = 7000
#用于KCP协议UDP通讯端口,在弱网环境下传输效率提升明显,但是会有一些额外的流量消耗。设置后frpc客户端须设置protocol = kcp
vhost_http_port = 80
#http监听端口,注意可能和服务器上其他服务用的80冲突,比如centos有些默认有Apache,可自定义
vhost_https_port = 443
#https监听端口,可自定义
dashboard_port = 7500
#通过浏览器查看 frp 的状态以及代理统计信息展示端口,可自定义
dashboard_user = admin
#信息展示面板用户名
dashboard_pwd = admin
#信息展示面板密码
log_max_days = 7
#最多保存多少天日志
privilege_token = frp888
#特权模式认证密钥
privilege_allow_ports = 1-65535
#端口白名单,为了防止端口被滥用,可以手动指定允许哪些端口被使用
max_pool_count = 100
#每个内网穿透服务限制最大连接池上限,避免大量资源占用,可自定义
authentication_timeout = 0
#frpc 所在机器和 frps 所在机器的时间相差不能超过 15 分钟,因为时间戳会被用于加密验证中,防止报文被劫持后被其他人利用,单位为秒,默认值为 900,即 15 分钟。如果修改为 0,则 frps 将不对身份验证报文的时间戳进行超时校验。国外服务器由于时区的不同,时间会相差非常大,这里需要注意同步时间或者设置此值为0
log_file = frps.log
log_level = info

详细说明请看作者中文说明文档:https://github.com/fatedier/frp/blob/master/README_zh.md

Last modification:March 18th, 2019 at 01:42 am
If you think my article is useful to you, please feel free to appreciate

Leave a Comment

30 comments

  1. 大黄鱼   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 57.0.2987.98 Google Chrome 57.0.2987.98 )

    非常感谢搭建,有个问题咨询一下,我用来群晖的内网穿透,为何老是返回 local_port not found

  2. six   ( Mac OS X 10.14.3 Mac OS X 10.14.3 / Safari 12.0.3 Safari 12.0.3 )

    我这里总提示: 2019/02/16 11:45:30 [W] [service.go:81] login to server failed: i/o deadline reached
    配置如下:
    1 [common]
    2 server_addr = freenat.bid
    3 server_port = 7000
    4 token = frp888
    5 privilege_token = frp888
    6 protocol = kcp
    7 kcp_bind_port = 7000

    1. 呵呵哒萌萌哒   ( Windows 7 x64 Edition Windows 7 x64 Edition / Google Chrome 72.0.3626.109 Google Chrome 72.0.3626.109 )
      @six

      应该是服务器用的人多了,稍微有点不稳,加上这条吧
      login_fail_exit = false
      #设置为false,frpc连接frps失败后重连,默认为true不重连

      1. six   ( Mac OS X 10.14.3 Mac OS X 10.14.3 / Safari 12.0.3 Safari 12.0.3 )
        @呵呵哒萌萌哒

        尝试无数次还是失败,感谢博主回复

        1. 呵呵哒萌萌哒   ( Windows 7 x64 Edition Windows 7 x64 Edition / Google Chrome 72.0.3626.109 Google Chrome 72.0.3626.109 )
          @six

          protocol = kcp去掉试试

  3. 王建岐   ( Other System Other System / Other Browser Other Browser )

    我自己也搭建了一个,感觉挺稳定的!

  4. .   ( Other System Other System / Other Browser Other Browser )

    看了看还可以诶

  5. 王浩   ( Android 8.1 Android 8.1 / QQ 浏览器 6.2 QQ 浏览器 6.2 )

    楼主,你好

    我配置好了,里面没有 让输入域名的地方啊,怎么自定义自己的域名

  6. besteffor   ( Windows 7 x64 Edition Windows 7 x64 Edition / Google Chrome 69.0.3497.100 Google Chrome 69.0.3497.100 )

    博主棒棒的,建立弄个付费讨论组,比较好管理~

    1. 呵呵哒萌萌哒   ( Android 8.1.0 Android 8.1.0 / WebView 4.0 WebView 4.0 )
      @besteffor

      我的不是付费的,我的是,欢迎加入frp内网穿透交流(freenat),群聊号码:912388232

  7. maxshiroi   ( Android 9 Android 9 / WebView 4.0 WebView 4.0 )

    可以建站免备案吗?OωO

    1. 呵呵哒萌萌哒   ( Android 8.1.0 Android 8.1.0 / WebView 4.0 WebView 4.0 )
      @maxshiroi

      是否要求备案在于服务器在哪,服务器在国内就要求备案,我共享的服务器在国外

  8. 湖陆海   ( Windows 10 x64 Edition Windows 10 x64 Edition / Microsoft Edge 17.17134 Microsoft Edge 17.17134 )

    你好,21版本的服务器怎么了?

    1. 呵呵哒萌萌哒   ( Android 8.1.0 Android 8.1.0 / WebView 4.0 WebView 4.0 )
      @湖陆海

      被墙了,晚上再换,现在没时间

  9. yuan   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 70.0.3538.77 Google Chrome 70.0.3538.77 )

    老是断开,0.21.0那台服务器
    control writer is closing
    read from workConn for udp error
    work connection closed
    writer goroutine for udp work connection closed
    reconnect to server error
    try to reconnect to server...
    reconnect to server error: i/o deadline reached

  10. cc   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 69.0.3497.100 Google Chrome 69.0.3497.100 )

    freenat.bid 貌似挂了……

    1. 呵呵哒萌萌哒   ( Windows 7 x64 Edition Windows 7 x64 Edition / Google Chrome 69.0.3497.100 Google Chrome 69.0.3497.100 )
      @cc

      已经恢复,感觉freenat.bid被攻击很多次了,,,,,

      1. cc   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 69.0.3497.100 Google Chrome 69.0.3497.100 )
        @呵呵哒萌萌哒

        谢谢~ 辛苦了

  11. Target   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 67.0.3396.99 Google Chrome 67.0.3396.99 )

    我自己搭建的显示连接超时是为什么啊(服务端是阿里云liunx 端口是通的) 客户端是windows 的 版本是0.16.1

    1. 呵呵哒萌萌哒   ( Windows 7 x64 Edition Windows 7 x64 Edition / Google Chrome 68.0.3440.106 Google Chrome 68.0.3440.106 )
      @Target

      服务端客户端时间,服务端客户端版本一样吗?

  12. 銷จุ๊บ鏱     ( Other System Other System / Other Browser Other Browser )

    这个是不是相当于花生壳?

    1. 呵呵哒萌萌哒   ( Windows 7 x64 Edition Windows 7 x64 Edition / Google Chrome 68.0.3440.106 Google Chrome 68.0.3440.106 )
      @銷จุ๊บ鏱  

      比花生壳好用不知道几百倍

  13. aiyolo   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 67.0.3396.99 Google Chrome 67.0.3396.99 )

    为什么老是断线啊

    1. 呵呵哒萌萌哒   ( Android 8.0 Android 8.0 / Opera 4.0 Opera 4.0 )
      @aiyolo

      服务器断?还是你客户端掉了?服务器的话是哪台?

  14. xhibin   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 67.0.3396.99 Google Chrome 67.0.3396.99 )

    centos 怎么让在后台运行

    1. 呵呵哒萌萌哒   ( Windows 7 x64 Edition Windows 7 x64 Edition / Google Chrome 68.0.3440.106 Google Chrome 68.0.3440.106 )
      @xhibin

      把启动命令加到rc.local就可以开机自动启动了,或者用nohup或screen

  15. mandolin   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 64.0.3282.140 Google Chrome 64.0.3282.140 )

    lz 按照之前你的推荐买了shark的vps 去年12月27日下单 ,,,现在还没开通,最近显示以下内容:
    Hi, If you have reached this page, you have a paypal dispute active, your account is locked until dispute issue will be solved. thank you。
    这是跑路了么?

    1. 呵呵哒   ( Windows 7 x64 Edition Windows 7 x64 Edition / Firefox 57.0 Firefox 57.0 )
      @mandolin

      估计是的,赶紧PayPal争议吧,我的已经全部争议了,不好意思把你坑了
      PS:我的原博客,图床全没了,挂掉大半个月发工单没人管(ó﹏ò。)

      1. mandolin   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 64.0.3282.140 Google Chrome 64.0.3282.140 )
        @呵呵哒

        没事 谢谢 。。。我用信用卡支付的 估计回不来了

        1. 呵呵哒   ( Windows 7 x64 Edition Windows 7 x64 Edition / Firefox 57.0 Firefox 57.0 )
          @mandolin

          以后买东西建议PayPal支付,这样有问题180天内基本都可以要回来