通过 SSH 访问内网机器

通过简单配置 TCP 类型的代理,使用户能够访问内网服务器。

步骤

  1. 在具有公网 IP 的机器上部署 frps

    部署 frps 并编辑 frps.toml 文件。以下是简化的配置,其中设置了 frp 服务器用于接收客户端连接的端口:

    bindPort = 7000
          
  2. 在需要被访问的内网机器上部署 frpc

    部署 frpc 并编辑 frpc.toml 文件,假设 frps 所在服务器的公网 IP 地址为 x.x.x.x。以下是示例配置:

    serverAddr = "x.x.x.x"
          serverPort = 7000
          
          [[proxies]]
          name = "ssh"
          type = "tcp"
          localIP = "127.0.0.1"
          localPort = 22
          remotePort = 6000
          
    • localIPlocalPort 配置为需要从公网访问的内网服务的地址和端口。
    • remotePort 表示在 frp 服务端监听的端口,访问此端口的流量将被转发到本地服务的相应端口。
  3. 启动 frps 和 frpc

  4. 通过 SSH 访问内网机器

    使用以下命令通过 SSH 访问内网机器,假设用户名为 test:

    ssh -o Port=6000 test@x.x.x.x
          

    frp 将请求发送到 x.x.x.x:6000 的流量转发到内网机器的 22 端口。

最后修改 November 15, 2023: fix 404 (#71) (626ce4d)

Access the private network machine through SSH

Through Agent of simple Configuration TCP type. Use users can access the intranet server

Steps

  1. Deploy frps on a machine with a public network IP

    Deploy frps and edit frps.toml. Files. The following is a simplified Configuration with frp set. The port used by the server to receive Client connections:

    bindPort = 7000
          
  2. Deploy frpc on the intranet machine that needs to be accessed

    Deploy frpc and edit the frpc.toml file, assuming frps The public IP address of the server is x. X.x.x. The following is ExampleConfiguration:

    serverAddr = "x.x.x.x"
          serverPort = 7000
          
          [[proxies]]
          name = "ssh"
          type = "tcp"
          localIP = "127.0.0.1"
          localPort = 22
          remotePort = 6000
          
    • localip localport allocation
    • Remote PortFRP server side
  3. Start FRPS and FRPC

  4. Access the private network machine through SSH

    Use the following command to Access the private network machine through SSH, assuming the username is test:

    ssh -o Port=6000 test@x.x.x.x
          

    FRP sends requests to The traffic of x.x.x.x: 6000 is forwarded to port 22 of the internal network machine.

Last modified November 15, 2023: fix 404 (#71) (626ce4d)