Lede frp 配置记录

流量流程:
Frps外网ip(160.10.168.112 ) -->Lede软路由(frpc 192.168.0.1) -->web服务器(192.168.0.8 )

frps外网服务器版本:
`Distributor ID: Debian
Description:    Debian GNU/Linux 9.11 (stretch)
Release:        9.11
Codename:       stretch`

wget https://github.com/fatedier/frp/releases/download/v0.33.0/frp_0.33.0_linux_amd64.tar.gz

lede软路由更新frp: (可替换适当的版本)
`
wget https://github.com/fatedier/f... .tar.gz
tar -xzvf frp_0.33.0_linux_amd64.tar.gz
rm -rf /koolshare/frpc/frpc
cp /root/frp_0.33.0_linux_amd64/koolshare/frpc/
chmod +x /koolshare/frpc/frpc
`
debian 加启动项
编辑 /etc/init.d/frp.sh
`
chmod +x /etc/init.d/frp.sh
update-rc.d frp.sh defaults
`

#!/bin/bash
### BEGIN INIT INFO
# Provides:          frp
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Should-Start: $network
# Should-Stop: $network
# Default-Start:        2 3 4 5
# Default-Stop:         0 1 6
# Short-Description: frp
# Description: frp
### END INIT INFO

frpPath="/root/frp_0.33.0_linux_amd64 "
cd "$frpPath";
screen_name="frp"
cmd="${frpPath}/frps -c frps.ini";

screen -dmS $screen_name
screen -x -S $screen_name -p 0 -X stuff "$cmd";
screen -x -S $screen_name -p 0 -X stuff '\n';

注意: 
frp 配置文件中最好不要有中文,记得有一次frpc的服务怎么都启动不了,查了很久没找出原因,后来把配置文件中的中文删掉问题就解决了.

frps 配置文件:

# [common] is integral section
[common]
# A literal address or host name for IPv6 must be enclosed
# in square brackets, as in "[::1]:80", "[ipv6-host]:http" or "[ipv6-host%zone]:80"
bind_addr = 0.0.0.0
bind_port = 22
# udp port used for kcp protocol, it can be same with 'bind_port'
# if not set, kcp is disabled in frps
#kcp_bind_port = 5443
kcp_bind_port = 22
# if you want to configure or reload frps by dashboard, dashboard_port must be set
dashboard_port = 6443
# dashboard assets directory(only for debug mode)
dashboard_user = admin
dashboard_pwd = dashboard_pwd
# assets_dir = ./static
vhost_http_port = 80
vhost_https_port = 443
# console or real logFile path like ./frps.log
log_file = ./frps.log
# debug, info, warn, error
log_level = info
log_max_days = 3
# auth token
token = serverPasswd
# only allow frpc to bind ports you list, if you set nothing, there won't be any limit
#allow_ports = 1-65535
# pool_count in each proxy will change to max_pool_count if they exceed the maximum value
max_pool_count = 50
# if tcp stream multiplexing is used, default is true
tcp_mux = true

frps外网ip: 160.10.168.112
web服务器: 192.168.0.8
token = serverPasswd

frpc 配置文件:

[common]

server_addr = 160.10.168.112
server_port = 22



# connections will be established in advance

pool_count = 5



# use tcp stream multiplexing

tcp_mux = true



# user name

#user = RaspberryPi

token = serverPasswd



log_file = ./frpc.log

log_level = info

log_max_days = 30



[web-80]

type = http

local_ip = 192.168.0.8

local_port = 80

remote_port = 80

custom_domains = *.domain1.com,*.domain3.com,*.domain2.com,domain1.com,domain3.com,domain2.com,160.10.168.112

use_encryption = true

use_compression = true





[web-443]

type = https

local_ip = 192.168.0.8

local_port = 443

remote_port = 443

custom_domains = *.domain1.com,*.domain3.com,*.domain2.com,domain1.com,domain3.com,domain2.com,160.10.168.112

use_encryption = true

use_compression = true

注意:

把frps的外网IP加到custom_domains 中,这样直接访问外网IP就不会出现frp的默认页面了。

你可能感兴趣的:(frp)