Setup FRP

From Hawk Wiki
Jump to: navigation, search

Setup frp client

# arm64
#wget https://github.com/fatedier/frp/releases/download/v0.44.0/frp_0.44.0_linux_arm64.tar.gz
#tar -xvzf frp_0.44.0_linux_arm64.tar.gz
#cd frp_0.44.0_linux_arm64

# amd 64
wget https://github.com/fatedier/frp/releases/download/v0.44.0/frp_0.44.0_linux_amd64.tar.gz
tar -xvzf frp_0.44.0_linux_amd64.tar.gz
cd frp_0.44.0_linux_amd64


sudo su
mkdir -p /usr/local/frpc
cp frpc /usr/local/frpc/frpc
cp frpc.ini /usr/local/frpc/frpc.ini


cat << EOF > /usr/local/frpc/frpc.ini
[common]
server_addr = 127.0.0.1
server_port = 7000

[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 6000
EOF


cat << EOF > /etc/systemd/system/frpc.service
[Unit]
Description=frp client
Wants=network-online.target
After=network.target network-online.target

[Service]
ExecStart=/usr/local/frpc/frpc -c /usr/local/frpc/frpc.ini
Restart=always
RestartSec=30

[Install]
WantedBy=multi-user.target
EOF

sudo systemctl daemon-reload && sudo systemctl enable frpc && sudo systemctl start frpc

sudo systemctl status frpc

Setup frp server

sudo su
mkdir -p /usr/local/frps
cp frps /usr/local/frps/frps
cp frps.ini /usr/local/frps/frps.ini
# set port number


#setup service
cat << EOF > /etc/systemd/system/frps.service
[Unit]
Description=frp server
Wants=network-online.target
After=network.target network-online.target

[Service]
ExecStart=/usr/local/frps/frps -c /usr/local/frps/frps.ini

EOF

sudo systemctl daemon-reload && sudo systemctl enable frps && sudo systemctl start frps