Prerequisite

Please purchase/rent a cloud server online.

E.g.

Download the frp application tarball from github

Please read the README at first in the following link.

https://github.com/fatedier/frp

After that, please download the release tarball from the following link.

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

It is complitable with different operating systems here: Windows/Linux/MacOS.

Method 1: Click the download link.

Method 2: CLI.

1
2
3
4
5
# Check the basic structure
uname -a

# For example, download the amd64 structure Linux
wget https://github.com/fatedier/frp/releases/download/v0.62.0/frp_0.62.0_linux_amd64.tar.gz

Modify the frp server configuration file

Login to your cloud server

1
2
ssh root@<public-ip>
<Passwd> Or download the pem keyfile.

Decompress the frp tarball

1
tar -xvf frp_0.62.0_linux_amd64.tar.gz

Edit the frps.toml file

1
2
3
4
cd frp_0.62.0_darwin_arm64
vim frps.toml
# Change the port as you want(default 7000)
bindPort = <portnumber>

Start up the frps service in the backend

1
2
3
nohup ./frps -c frps.toml > frps.log 2>&1 &
# Check the jobs status
jobs

Modify the frp client configuration file

Login to the server that you want to ssh(maybe in the firewall)

1
2
ssh <frpc-client-username>@client-ip
<Passwd> Or private key.

Decompress the frp tarball

1
tar -xvf frp_0.62.0_linux_amd64.tar.gz

Edit the frps.toml file

Method 1

1
2
3
4
5
6
7
8
9
10
11
12
cd frp_0.62.0_darwin_arm64
vim frpc.toml

serverAddr = "<the public ip you purchase in cloud>"
serverPort = <same as the frp server portnumber>

[[proxies]]
name = "<set a name as you want>"
type = "tcp"
localIP = "127.0.0.1"
localPort = 22
remotePort = <allocate a remotePort>

If you would like to deploy more than one server, just modify the name and remotePort parameters to be different with each server.

Method 2

Aonther method is to use tcpmuxHTTPConnectPort and set the same serverPort.

First, Install socat.

1
dnf/apt install socat
  • frps:

    1
    2
    3
    4
    5
    cd frp_0.62.0_darwin_arm64
    vim frps.toml
    # Change the port as you want(default 7000)
    bindPort = <portnumber>
    tcpmuxHTTPConnectPort = <portnumber>
  • frpc:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    serverAddr = "x.x.x.x"
    serverPort = 7000

    [[proxies]]
    name = "<set a name as you want>"
    type = "tcpmux"
    multiplexer = "httpconnect"
    customDomains = ["<set a domain name as you want>"]
    localIP = "127.0.0.1"
    localPort = 22

Start up the frpc service in the backend

1
2
3
nohup ./frpc -c frpc.toml > frpc.log 2>&1 &
# Check the jobs status
jobs

How to use

Server A -> Server B(in firewall or internel network)

Method 1

1
2
ssh -p <remotePort> <serverB-username>@<public-ip you purchase in cloud>
=> serverB-username in serverB's password or private key.

Method 2

1
ssh -o 'proxycommand socat - PROXY:<public ip you purchase in cloud>:%h:%p,proxyport=<same as the tcpmuxHTTPConnectPort number>' <serverB-username>@<domain name>

Up to now, you’ve successfully use frp service to access services/servers located within the internal network.