frp 安装与配置

1 Download

wget https://github.com/fatedier/frp/releases/download/v0.23.1/frp_0.23.1_linux_amd64.tar.gz

2 Install

tar xvf frp_0.23.1linux_amd64.tar.gz
mv frp_0.23.1_linux_amd64 frp
mv ./frp/frps /bin/
mv ./frp/frpc /bin/
mv frp /etc

3 Configure Server Service

vi /etc/frp/frps.ini

[common]

bind_port = 6666
vhost_http_port = 8666
dashboard_port = 8667
dashboard_user = comet
dashboard_pwd = 12345678
privilege_token = 3gcomet
allow_ports = 20001-49999
log_file = /var/log/frps.log
log_level = info
log_max_days = 7

4 Enable Server Service

vi /lib/systemd/system/frps.service

[Unit]
Description=frps
After=network.target

[Service]
TimeoutStartSec=30
ExecStart=/bin/frps -c /etc/frp/frps.ini
ExecStop=/bin/kill $MAINPID

[Install]
WantedBy=multi-user.target

systemctl enable frps
systemctl start frps

5 Configure Client Service

Repeat Step No.1 and Step No.2 to get frp in client mechine.

vi /etc/frp/frpc.ini

[common]

server_addr = f.3gcomet.com
server_port = 6666
privilege_token = 3gcomet

log_file = /var/log/frpc.log
log_level = info
log_max_days = 3

[ssh204]

type = tcp
local_ip = 127.0.0.1
local_port = 9230
remote_port = 20422

[web204]

type = http
local_port = 80
local_ip = 127.0.0.1
remote_port = 20480
custom_domains = test.3gcomet.com

6 Enable Client Service

vi /lib/systemd/system/frpc.service

[Unit]
Description=frpc
After=network.target

[Service]
TimeoutStartSec=30
ExecStart=/bin/frpc -c /etc/frp/frpc.ini
ExecStop=/bin/kill $MAINPID

[Install]
WantedBy=multi-user.target

systemctl enable frpc
systemctl start frpc

7 Configure DNS

set test.3gcomet.com to the frp server.

8 Connect

ssh -p 20422 test.3gcomet.com
w3m http://test.3gcomet.com:8666