Setup FRP

From Hawk Wiki
Revision as of 19:18, 2 April 2023 by Hall (Talk | contribs)

Jump to: navigation, search
    1. 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


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

[Install]
WantedBy=multi-user.target
EOF

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

sudo systemctl status frpc
    1. Setup frp server
mkdir -p /usr/local/frps
cp frps /usr/local/frpc/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