码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • FRP远程连接


    前言

    通过frp和跳板机完成局域网服务器访问。工具地址:https://github.com/fatedier/frp

    在这里插入图片描述

    配置frp过程

    1. 下载frp工具,下载地址如下:

      https://github.com/fatedier/frp/releases

      这里我选择了v0.57.0

    2. 解压到本地路径

      tar -zxvf xxxxxx.tar.gz
      
      • 1
    3. 配置服务器端和客户端,这里直接从官网copy过来一份:

      # 1. Modify frps.toml on server A by setting the bindPort for frp clients to connect to:
      # frps.toml
      bindPort = 7000
      
      # 2. Start frps on server A:
      ./frps -c ./frps.toml
      
      # 3. Modify frpc.toml on server B and set the serverAddr field to the public IP address of your frps server:
      # frpc.toml
      serverAddr = "x.x.x.x"
      serverPort = 7000
      
      [[proxies]]
      name = "ssh"
      type = "tcp"
      localIP = "127.0.0.1"
      localPort = 22
      remotePort = 6000
      # Note that the localPort (listened on the client) and remotePort (exposed on the server) are used for traffic going in and out of the frp system, while the serverPort is used for communication between frps and frpc.
      
      # 4. Start frpc on server B:
      ./frpc -c ./frpc.toml
      
      # 5. To access server B from another machine through server A via SSH (assuming the username is test), use the following command:
      ssh -oPort=6000 test@x.x.x.x
      
      • 1
      • 2
      • 3
      • 4
      • 5
      • 6
      • 7
      • 8
      • 9
      • 10
      • 11
      • 12
      • 13
      • 14
      • 15
      • 16
      • 17
      • 18
      • 19
      • 20
      • 21
      • 22
      • 23
      • 24
      • 25
    4. 配置云服务器的安全组端口入站和出站规则,具体查阅网上资料吧

    更多信息见官网:https://github.com/fatedier/frp

    设置frpc开机自启

    1. 添加systemd配置文件

      vim /usr/lib/systemd/system/frp.service
      
      • 1
    2. 添加如下内容:

      [Unit]
      Description=The nginx HTTP and reverse proxy server
      After=network.target
      
      [Service]
      Type=simple
      Restart=on-failure
      RestartSec=5s
      ExecStart=/opt/frp_0.57.0_linux_amd64/frpc -c /opt/frp_0.57.0_linux_amd64/frpc.toml # 这里根据实际情况修改
      ExecReload=/opt/frp_0.57.0_linux_amd64/frpc reload -c /opt/frp_0.57.0_linux_amd64/frpc.toml # 根据实际情况修改
      KillSignal=SIGQUIT
      TimeoutStopSec=5
      KillMode=process
      PrivateTmp=true
      StandardOutput=syslog
      StandardError=inherit
      
      [Install]
      WantedBy=multi-user.target
      
      • 1
      • 2
      • 3
      • 4
      • 5
      • 6
      • 7
      • 8
      • 9
      • 10
      • 11
      • 12
      • 13
      • 14
      • 15
      • 16
      • 17
      • 18
      • 19
    3. 设置开机启动

      systemctl daemon-reload
      systemctl enable frp
      
      • 1
      • 2
    4. 手动启动

      systemctl start frp
      
      • 1

    常见问题

    记录了我自己在安装过程中遇到的问题,如下:

    问题: Connection closed by remote host
    解决:

    sudo apt update && sudo apt upgrade && sudo apt install openssh-server
    参考: https://github.com/fatedier/frp/issues/2064

    问题:Host key verification failed.
    解决:

    删除本地的know_host
    参考:https://blog.csdn.net/Doitm/article/details/127907684

    参考资料

    1. frp设置开机自启服务
    2. frp开机启动
  • 相关阅读:
    安卓讲课笔记6.1 共享参数
    Mac 电脑查看本地maven,及私有仓库的搭建与使用【nexus的配置与使用】
    【发展史】鼠标的发展史
    数据库索引失效
    使用高防服务器有什么好处?103.216.155.x
    区块链正在开启一场回归商业,融合商业的新发展
    Cent OS 使用ip addr or nmcli 分配临时IP地址
    外包干了8天,技术退步明显。。。。。
    Eureka详解
    request对象对请求体,请求头参数的解析
  • 原文地址:https://blog.csdn.net/xuyangcao123/article/details/138151163
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号