Reference: Access your computer in a LAN network via SSH.

On server A (in the LAN):

  • set up frp client:

    1
    2
    3
    4
    
    wget https://github.com/fatedier/frp/releases/download/v0.53.2/frp_0.53.2_linux_amd64.tar.gz
    tar -zxvf frp_0.53.2_linux_amd64.tar.gz
    cd frp_0.53.2_linux_amd64
    nano frpc.toml
    
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    
    # frpc.toml
    serverAddr = "43.139.224.203" # public IP
    serverPort = 7000
    
    [[proxies]]
    name = "ssh"
    type = "tcp"
    localIP = "127.0.0.1"
    localPort = 1220
    remotePort = 6000
    
    • Make 6000 and 7000 accessible: sudo ufw allow 6000 andsudo ufw allow 7000 .
  • run frp client by

    1
    
    ./frpc -c ./frpc.toml
    

    or

    1
    
    nohup ./frpc -c ./frpc.toml &
    

    If any conflicts:

    1
    
    pkill -f frpc
    

On server B (with a public ip address):

  • set up frp server:

    1
    2
    3
    4
    
    wget https://github.com/fatedier/frp/releases/download/v0.53.2/frp_0.53.2_linux_amd64.tar.gz
    tar -zxvf frp_0.53.2_linux_amd64.tar.gz
    cd frp_0.53.2_linux_amd64
    nano frps.toml
    
    1
    2
    
    # frps.toml
    bindPort = 7000
    
  • run frp server by

    1
    
    ./frps -c ./frps.toml
    

    or

    1
    
    nohup ./frps -c ./frps.toml &
    

    if any coflicts:

    1
    
    pkill -f frps
    

On your computer oustide the LAN containing server B:

1
ssh -oPort=6000 lasso@43.139.224.203