1、启动树莓派
2、设置树莓派IP地址
一般我们只输入这句就可以
sudo ifconfig eth0 192.168.10.189 netmask 255.255.255.0
3、sudo route add default gw 192.168.10.1
sudo ifconfig eth0 up
4、修改 /etc/network/interfaces
sudo vim /etc/network/interfaces
修改为:
auto lo
iface lo inet loopback
iface eth0 inet static
address 192.168.10.189
netmask 255.255.255.0
gateway 192.168.10.1
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
5、重启服务
sudo service networking start
6、设置DNS
vi /etc/resolv.conf
nameserver 192.168.10.1
nameserver 8.8.8.8
重启net
/etc/init.d/network restart