树莓派内网穿透之使用公网ip进行frp穿透

1. 准备材料

  • 树莓派
  • 具有公网IP的服务器(阿里云)
  • 域名(有域名更加方便,建议购买域名)
  • 在安全组中开放服务端和客户端所需的端口

2. 服务器配置

2.1 下载frp服务端程序(对应自己的架构)

官网地址:https://github.com/fatedier/frp/releases

1. wget https://github.com/fatedier/frp/releases/download/v0.32.0/frp_0.32.0_linux_386.tar.gz
2. tar -xvf frp_0.32.0_linux_386.tar.gz  
3. cd frp_0.32.0_linux_386 

2.2 文件介绍(服务端客户端相同)

ubuntu@VM-0-9-ubuntu:~/frp_0.32.0_linux_386$ ls            
frpc           frpc.ini  frps_full.ini  LICENSE            
frpc_full.ini  frps      frps.ini       systemd 

frp后面带frp"c"后面带c为客户端文件,后面带frp"s"为服务端文件
文件名字功能
frps服务端运行文件
frps.ini服务端配置文件
frps_full.ini服务端配置说明文件
frpc客户端运行文件
frpc.ini客户端配置文件
frpc_full.ini客户端配置说明文件

2.3 服务端配置

vim frps.ini

[common]
bind_addr = 0.0.0.0
bind_port = 7000    #frp服务端口,需与frpc.ini相同
vhost_http_port = 80    #http服务端口
vhost_https_port = 443    #https服务端口
dashboard_port = 7500    #控制台端口
privilege_token = 123456    #特权模式密钥,需与frpc.ini相同

log_file = /bin/frps.log    #日志文件存储路径
log_level = info    #日志记录级别
log_max_days = 3    #日志最大存储天数
max_pool_count = 5
authentication_timeout = 900

subdomain_host = frp.com    #服务端绑定域名
tcp_mux = true

3. 客户端(树莓派或者其他内网应用)配置

3.1 下载frp客户端程序(对应自己的架构)

wget https://github.com/fatedier/frp/releases/download/v0.32.0/frp_0.32.0_linux_arm.tar.gz
tar -xvf frp_0.32.0_linux_arm.tar.gz
cd frp_0.32.0_linux_arm 

3.2 配置客户端

vim frpc.ini 
[common] 
server_addr = 服务器地址 
server_port = 与服务器bind_port相同 
token =身份密钥 

[ssh] 
type = tcp 
local_ip = 树莓派所在局域网 
local_port = 22服务端口 
remote_port = 6000 外网访问的端口 

[web] 
type = http 
local_port = 80#服务端口 
subdomain = 自定义子域名如(web) 
#custom_domains = 域名或公网IP,与subdomain二选一 

[web2] 
type = http 
local_port = 8080#服务端口 
custom_domains = 自定义子域名

4. 如果嫌配置麻烦可以使用别人写好的脚本一键配置

Github:
wget https://raw.githubusercontent.com/MvsCode/frps-onekey/master/install-frps.sh -O ./install-frps.sh
chmod 700 ./install-frps.sh
./install-frps.sh install

Aliyun:
wget https://code.aliyun.com/MvsCode/frps-onekey/raw/master/install-frps.sh -O ./install-frps.sh
chmod 700 ./install-frps.sh
./install-frps.sh install(之后参考上面的配置进行一一配置)

Uninstall(卸载)

./install-frps.sh uninstall

Update(更新,frp版本更新时使用)

./install-frps.sh update

Server management(服务管理器)

Usage: /etc/init.d/frps {start|stop|restart|status|config|version}

  • 2
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

GeekFong

记录不易,坚持更新

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值