8

frp内网穿透配置

 2 years ago
source link: https://blog.guyskk.com/notes/frp%E5%86%85%E7%BD%91%E7%A9%BF%E9%80%8F%E9%85%8D%E7%BD%AE
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

frp内网穿透配置

2016年, 11月21日

frp是一个高性能的反向代理应用,可以帮助您轻松地进行内网穿透,对外网提供服务。 可以在 https://github.com/fatedier/frp 找到文档和下载地址。

frp分为服务端(frps)和客户端(frpc),服务端运行在公网服务器上,客户端运行在内网服务器或电脑上。 frp的特权模式配置比较简单灵活,服务端启动之后就不用管它了。

这里使用特权模式并开启了dashboard。

服务端配置

下载 frp程序 并解压,把frps复制到/usr/bin/目录里面。

编写配置文件,注意修改privilege_token为较复杂的密码。

/etc/frps/frps.ini:

[common]
bind_addr = 0.0.0.0
bind_port = 7000
vhost_http_port = 8000
dashboard_port = 7500
log_level = info
privilege_mode = true
privilege_token = 12345678
privilege_allow_ports = 4000-50000
max_pool_count = 100

使用systemd配置开机自启,适用于 Ubuntu 16 或 debian 8。

/etc/systemd/system/frps.service:

[Unit]
Description=frps daemon

[Service]
Type=simple
ExecStart=/usr/bin/frps -c /etc/frps/frps.ini

[Install]
WantedBy=multi-user.target

启动并设为开机自启。

$ systemctl start frps
$ systemctl enable frps

现在用浏览器访问服务器的7500端口就能看到dashboard了。

客户端配置

下载 frp程序 并解压,把frpc复制到/usr/bin/目录里面。

编写配置文件,common部分是必须有的(其中两个值需要按你的情况修改),其他部分可以有任意多个。

frpc.ini:

[common]
server_addr = {服务端IP地址}
server_port = 7000
log_level = info
privilege_token = {与服务端privilege_token相同}

[web]
privilege_mode = true
type = tcp
local_port = 5000
remote_port = 5000
use_encryption = true
use_gzip = true

启动客户端

frpc -c frpc.ini

本地运行一个web服务(Python 3)

python -m http.server 5000

现在用浏览器访问服务器的5000端口就能看到本地文件了。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK