【Network】反向代理 - frp

Posted by 西维蜀黍 on 2023-02-25, Last Modified on 2023-05-02


# macOS
$ brew install frps

# Ubuntu
$ curl -LO https://github.com/fatedier/frp/releases/download/v0.47.0/frp_0.47.0_linux_amd64.tar.gz; tar -xf frp_0.47.0_linux_amd64.tar.gz


Put frps and frps.ini onto your server A with public IP.

Put frpc and frpc.ini onto your server B in LAN (that can’t be connected from public Internet).

Access your computer in LAN by SSH

  1. Modify frps.ini on server A and set the bind_port to be connected to frp clients:
# frps.ini
bind_port = 7000
  1. Start frps on server A:
./frps -c ./frps.ini
  1. On server B, modify frpc.ini to put in your frps server public IP as server_addr field:
# frpc.ini
server_addr = x.x.x.x
server_port = 7000

type = tcp
local_ip =
local_port = 22
remote_port = 6000

Note that local_port (listened on client) and remote_port (exposed on server) are for traffic goes in/out the frp system, whereas server_port is used between frps.

  1. Start frpc on server B:
./frpc -c ./frpc.ini
  1. From another machine, SSH to server B via server A like this (assuming that username is test):
ssh -oPort=6000 test@x.x.x.x