树莓派4B 安装frp内网穿透连接ssh和vnc

1,187 阅读1分钟

frp

github.com/fatedier/fr…

frp is a fast reverse proxy to help you expose a local server behind a NAT or firewall to the Internet. As of now, it supports TCP and UDP, as well as HTTP and HTTPS protocols, where requests can be forwarded to internal services by domain name.

服务器端安装(Ubuntu18.04)

sudo apt-get update && sudo apt-get upgrade -y

## 下载frp
wget https://github.com/fatedier/frp/releases/download/v0.32.0/frp_0.32.0_linux_amd64.tar.gz
## 解压 删除压缩包 重命名文件夹
tar -zxvf frp_0.32.0_linux_amd64.tar.gz
rm frp_0.32.0_linux_amd64.tar.gz
mv frp_0.32.0_linux_amd64 frp
## 进入frp文件夹
cd frp

树莓派端安装(Raspbian buster)

sudo apt-get update && sudo apt-get upgrade -y

wget https://github.com/fatedier/frp/releases/download/v0.32.0/frp_0.32.0_linux_arm.tar.gz
## 解压
tar -zxvf frp_0.32.0_linux_arm.tar.gz 
rm frp_0.32.0_linux_arm.tar.gz 
mv frp_0.32.0_linux_arm/ frp

服务器端的配置

frpc.ini

[common]
server_addr = XXXXX96.com      #换成自己的服务器ip
server_port = 233

[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 222

[vnc]
type = tcp
local_ip = 127.0.0.1
local_port = 5900
remote_port = 5900

image.png

客户端配置

frps.ini

[common]
bind_port = 233     

image.png

启动服务器与客户端

## ubuntu
$ ./frps -c ./frps.ini

## 树莓派
pi@raspberrypi:~/frp $ ./frpc -c ./frpc.ini 

image.png

测试

image.png