ref: https://github.com/fatedier/frp
1.内网穿透
1.1 服务器端 VPS 配置
下载匹配的版本,https://github.com/fatedier/frp/releases
1 2 3
   |  [common] bind_port = 7000
 
  | 
 
1.2 客户端配置
- 修改 frpc.ini 文件,假设 frps 所在服务器的公网 IP 为 123.123.1.0;
 
1 2 3 4 5 6 7 8 9 10
   |  [common] server_addr = 123.123.1.0 server_port = 7000
  [ssh] type = tcp local_ip = 127.0.0.1 local_port = 22 remote_port = 6000
 
  | 
 
1.3 远程访问
1
   | ssh root@123.123.1.0 -oPort=6000 
   | 
 
2. 自动启动 frp 服务–使用 systemctl
1
   | sudo nano /lib/systemd/system/frp.service 
   | 
 
- 2.2 写入以下内容,注意区分 服务端 和 客户端
 
1 2 3 4 5 6 7 8 9 10 11 12 13 14
   | [Unit] Description=frp service After=network.target syslog.target Wants=network.target
  [Service] Type=simple
  ExecStart=/home/ubuntu/frp/frps -c /home/ubuntu/frp/frps.ini
 
 
  [Install] WantedBy=multi-user.target
   | 
 
1 2 3 4
   |  sudo systemctl start frp
  sudo systemctl enable frp
 
  | 
 
1 2 3 4 5 6
   | # 重启 sudo systemctl restart frp # 停止 sudo systemctl stop frp # 查看日志 sudo systemctl status frp
   |