因为为了方便以后做实验,所以就把之前安装好的环境导出到VOF模板 。然后今天需要两个虚拟机的时候,便又导入之前准备的环境。ping 网络的时候发现一直ping不通,后来ifconfig一下发现
[root@doraemon network-scripts]# ifconfig
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:32 errors:0 dropped:0 overruns:0 frame:0
TX packets:32 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2288 (2.2 KiB) TX bytes:2288 (2.2 KiB)
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: Device eth0 does not seem to be present, delaying initialization.[FAILED]// 设备eth0 并不存在,延迟初始化
于是上网查询 找到解决办法
root 用户下 vi /etc/udev/rules.d/70-persistent-net.rules 内容如下:
#This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.
# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:63:f4:90", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:15:fa:62", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
~
记录下eth1的MAC地址 00:0c:29:15:fa:62
接下来 进入/etc/sysconfig/network-scripts/的目录下
[root@doraemon ~]# cd /etc/sysconfig/network-scripts/
[root@doraemon network-scripts]# mv ifcfg-eth0 ifcfg-eth1
进入 ifcfg-eth1编辑 将DEVICE 后的eth0 改为eth1,并将 HWADDR后的MAC地址改为前面标记的 [root@doraemon network-scripts]# vi ifcfg-eth1
DEVICE=eth1
TYPE=Ethernet
HWADDR= 00:0c:29:15:fa:62
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.88.22
NETMARK=255.255.255.0
[root@doraemon network-scripts]# ifconfig
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:32 errors:0 dropped:0 overruns:0 frame:0
TX packets:32 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2288 (2.2 KiB) TX bytes:2288 (2.2 KiB)
之前设定的静态ip并没有成功
然后尝试
[root@doraemon network-scripts]# service network restart
Shutting down loopback interface: [ OK ]
然后尝试
[root@doraemon network-scripts]# service network restart
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: Device eth0 does not seem to be present, delaying initialization.[FAILED]// 设备eth0 并不存在,延迟初始化
于是上网查询 找到解决办法
root 用户下 vi /etc/udev/rules.d/70-persistent-net.rules 内容如下:
#This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.
# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:63:f4:90", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:15:fa:62", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
~
记录下eth1的MAC地址 00:0c:29:15:fa:62
接下来 进入/etc/sysconfig/network-scripts/的目录下
[root@doraemon ~]# cd /etc/sysconfig/network-scripts/
[root@doraemon network-scripts]# mv ifcfg-eth0 ifcfg-eth1
进入 ifcfg-eth1编辑 将DEVICE 后的eth0 改为eth1,并将 HWADDR后的MAC地址改为前面标记的 [root@doraemon network-scripts]# vi ifcfg-eth1
DEVICE=eth1
TYPE=Ethernet
HWADDR= 00:0c:29:15:fa:62
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.88.22
NETMARK=255.255.255.0
最后保存 退出 重启网络
[root@doraemon network-scripts]# service network restart
Shutting down interface eth1: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth1: Determining if ip address 192.168.88.22 is already in use for device eth1... [ OK ]
[root@doraemon network-scripts]# service network restart
Shutting down interface eth1: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth1: Determining if ip address 192.168.88.22 is already in use for device eth1... [ OK ]
问题解决
ps:楼主发现mv操作之后 编辑ifcfg-eth1时,直接把MAC地址删掉 问题照样可以解决
ps:楼主发现mv操作之后 编辑ifcfg-eth1时,直接把MAC地址删掉 问题照样可以解决
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/30998225/viewspace-2088250/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/30998225/viewspace-2088250/