[转]ubuntu Ignoring unknown interface eth0=eth0

ubuntu Ignoring unknown interface eth0=eth0

来源:http://blog.sina.com.cn/s/blog_6fd605b50100qzvv.html

在设置静态IP的时候 不能保存
/etc/init.d/networking restart
 
提示
Ignoring unknown interface eth0=eth0. SIOCSIFADDR: No such device
ifconfig -a eth0是存在的
1.首先删除

 70-persistent-net.rules 文件 

该文件在 /etc/udev/rules.d/ 目录下 
rm -f /etc/udev/rules.d/70-persistent-net.rules
 

 之后重启让系统重新生成eth0配置文件

reboot
之后发现系统又自动获取IP了
2.手动修改 70-persistent-net.rules 文件
vi /etc/udev/rules.d/70-persistent-net.rules 
把eth0改为eth1
3.修改 /etc/network/interfaces 文件
 vi /etc/network/interfaces
 
内容如下
auto eth1 //自动启用eth1
iface eth1 inet static //eth1为静态IP
address 192.168.0.16 //ip地址
netmask 255.255.255.0 //子网掩码
gateway 192.168.0.1 //网关
4.修改/etc/resolv.conf 
vi /etc/resolv.conf 
 
修改DNS 内容如下
# Generated by NetworkManager
nameserver 219.149.194.55  //电信DNS
nameserver 8.8.8.8 //谷歌提供的免费DNS解析
 ubuntu12.04 版这个方法行不通了,因为  resolv.conf 每次重新启动以后会覆盖以前的文件,提示不让修改。
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
 因此需要在
/etc/network/interfaces 这个文件里最后一行加上

nameserver 219.149.194.55 //电信DNS
nameserver 8.8.8.8 //谷歌提供的免费DNS解析
5.保存之后重启networking服务
/etc/init.d/networking restart
 
OK 可以上网了。
 

猜你喜欢

转载自gxl-ct001.iteye.com/blog/1772861
今日推荐