树莓派通过路由器连VNC后,无法解析域名导致无法上网。
解决方法1:
修改resolv.config文件
pi@raspberrypi ~ $ sudo nano /etc/resolv.conf
pi@raspberrypi ~ $ sudo nano /etc/resolv.conf
改写后为 nameserver 8.8.8.8
保存退出
解决方法2:设置树莓派静态IP
修改 /etc/network/interfaces
sudo vim /etc/network/interfaces
修改为:
<span style="font-family:SimSun;font-size:14px;"><strong> auto lo
iface lo inet loopback
iface eth0 inet static
address 192.168.1.222
netmask 255.255.255.0
gateway 192.168.1.1
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf </strong></span>
然后重启服务
sudo service networking restart