Complete Guide to Use Frp
Prerequisite
Please purchase/rent a cloud server online.
E.g.
- Tencent Cloud: https://cloud.tencent.com/
- Amazon Cloud: https://aws.amazon.com/
- Ali Cloud: https://www.alibabacloud.com/
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 | # Check the basic structure |
Modify the frp server configuration file
Login to your cloud server
1 | ssh root@<public-ip> |
Decompress the frp tarball
1 | tar -xvf frp_0.62.0_linux_amd64.tar.gz |
Edit the frps.toml file
1 | cd frp_0.62.0_darwin_arm64 |
Start up the frps service in the backend
1 | nohup ./frps -c frps.toml > frps.log 2>&1 & |
Modify the frp client configuration file
Login to the server that you want to ssh(maybe in the firewall)
1 | ssh <frpc-client-username>@client-ip |
Decompress the frp tarball
1 | tar -xvf frp_0.62.0_linux_amd64.tar.gz |
Edit the frps.toml file
Method 1
1 | cd frp_0.62.0_darwin_arm64 |
If you would like to deploy more than one server, just modify the
name
andremotePort
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
5cd 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
10serverAddr = "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 | nohup ./frpc -c frpc.toml > frpc.log 2>&1 & |
How to use
Server A -> Server B(in firewall or internel network)
Method 1
1 | ssh -p <remotePort> <serverB-username>@<public-ip you purchase in cloud> |
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.