希望只要外部網路有通,不須做任何的防火牆設定,隨時隨地即可遠端連線到我的樹莓派主機,類似於TeamViewer 的功能。
sudo apt-get install vim
wget https://github.com/fatedier/frp/releases/download/v0.38.0/frp_0.38.0_linux_arm.tar.gz
tar -zxvf frp_0.38.0_linux_arm.tar.gz
sudo mkdir /var/fprc
sudo mv ./frp_0.38.0_linux_arm/* /var/frpc/
sudo vim /var/frpc/frpc.ini
[common] server_addr = your frps server domain server_port = 7000 auth_token = 123456 pool_count = 10000 [pi-ssh] type = tcp custom_domains = pi-ssh.abc.net remote_port = 6667 local_port = 22 local_ip = 127.0.0.1 [pi-vnc] type = tcp custom_domains = pi-vnc.abc.net local_port = 5900 remote_port = 6666 local_ip = 127.0.0.1
sudo ./frpc -c ./frpc.ini
sudo vi /lib/systemd/system/frpc.service
[Unit] Description=FRPC After=network.target Wants=network.target [Service] Restart=on-failure RestartSec=5 ExecStart=/var/frpc/frpc -c /var/frpc/frpc.ini [Install] WantedBy=multi-user.target
sudo systemctl enable frpc.service //開機時自動啟動 FRPC服務 sudo systemctl start frpc.service //啟動 FRPC 服務 sudo systemctl status frpc.service // 檢查狀態 sudo systemctl is-failed frpc.service // 查看失敗狀態 sudo systemctl daemon-reload // reload sudo reboot // 重開機