为与开发板连接的便利,将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