1.工具下载VNC
参照方法:https://shumeipai.nxez.com/2018/08/31/raspberry-pi-vnc-viewer-configuration-tutorial.html
2. 树莓派端VNC安装
3树莓派开启wifi并设置静态IP
参照方法:https://blog.csdn.net/shanelee73/article/details/80261879
sudo nano /etc/dhcpcd.conf
在文件结尾处添加如下代码
interface wlan0
static ip_address=192.168.1.111-------------你的内网ip地址/24
static routers=192.168.1.1------内网网关ip地址
static domain_name_servers=114.114.114.114 ------------自定义dns
4解决问题
(1)ping不到树莓派
参照方法:https://www.lxx1.com/3154
这时在树莓派使用有线连接并登陆,在树莓派路由表上添加这样的一条路由就可以了:
sudo route add default gw 192.168.0.1 #192.168.0.1是无线路由器的地址
(2)ping通后,VNC软件仍然无法访问,出现“Timed out waiting for a response from the computer”提示
查询发现可能是防火墙原因,在关掉计算机防火墙后,连接时出现提示“The connection was refused by the computer”
查找发现是因为树莓派上未开启VNC的服务,在树莓派端输入
vncserver 开启服务后即可连接
(3)设置VNC开机自启动
参照方法:https://blog.csdn.net/xqf1528399071/article/details/52192016
刚开始学习树莓派,一波三折。。。