爲與開發板連接的便利,將ubuntu的ip設置爲靜態,主要是DNS設置的問題,解決辦法有一下兩個:
1sudo vim /etc/network/interfaces 配置靜態ip
auto eth0
iface eth0 inet static
address 192.168.1.155
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8 8.8.4.4
之後保存,重啓網絡sudo /etc/init.d/networking restart 即可。
8.8.8.8 8.8.4.4谷歌提供的免費dns
2同上配置爲靜態ip
auto eth0
iface eth0 inet static
address 192.168.1.155
netmask 255.255.255.0
gateway 192.168.1.1
sudo vim /etc/resolv.conf添加
nameserver 8.8.8.8
nameserver 8.8.4.4
之後重啓網絡,但是有個問題,文件裏標明瞭
DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
每次重啓後,寫入的東西都被覆蓋掉了,於是重啓後得重新編輯。解決辦法刪除 # Generated by NetworkManager或
cd /etc/resolvconf/resolv.conf.d/
vi base
nameserver 8.8.8.8