使用Hyper-V或者VMware的时候,有时候需要克隆一个虚拟机出来,因此可能导致网卡类的问题。
测试过程如下(仅仅针对克隆的linux机器):
查看网卡基本配置:
0 1 2 3 4 5 6 7 8 9 |
[root@WWW ~]# cd /etc/sysconfig/network-scripts/ [root@WWW 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:16436 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) |
发现网卡没有启动,SO:
0 1 2 3 4 5 6 7 |
[root@WWW network-scripts]# cat ifcfg-eth0 DEVICE=eth0 #先不改,测试下 #HWADDR=00:25:5d:A7:43:59 #MAC地址,这个注销掉 TYPE=Ethernet #UUID=1586f23c-a72d-47a6-9231-ab1fd0c3b966 #通用唯一识别码,这个也注销掉 ONBOOT=yes #默认情况下,这个是no,都不跟随系统启动! NM_CONTROLLED=yes BOOTPROTO=dhcp |
继续测试:
0 1 2 3 4 |
[root@WWW network-scripts]# service network restart Shutting down loopback interface: [ OK ] Bringing up loopback interface: [ OK ] Bringing up interface eth0: Device eth0 does not seem to be present, delaying initialization. [FAILED] |
提示eth0网卡不存在,网卡1莫名变成了网卡2
0 1 2 |
[root@WWW network-scripts]# ifconfig eth0 up eth0: unknown interface: No such device [root@WWW network-scripts]# ifconfig eth1 up |
修改为网卡2
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
[root@WWW network-scripts]# cat ifcfg-eth0 DEVICE=eth1 #修改为网卡2 #HWADDR=00:25:5d:A7:43:59 TYPE=Ethernet #UUID=1586f23c-a72d-47a6-9231-ab1fd0c3b966 ONBOOT=yes NM_CONTROLLED=yes BOOTPROTO=dhcp [root@WWW network-scripts]# [root@WWW network-scripts]# service network restart Shutting down interface eth0: [ OK ] Shutting down loopback interface: [ OK ] Bringing up loopback interface: [ OK ] Bringing up interface eth0: Determining IP information for eth1... done. [ OK ] [root@WWW network-scripts]# mv ifcfg-eth0 ifcfg-eth1 #习惯性的修改了一下 [root@WWW 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 IP information for eth1... done. [ OK ] [root@WWW network-scripts]# |
可以自己配置静态IP
0 1 2 3 4 5 6 7 8 9 10 11 |
[root@WWW network-scripts]# cat ifcfg-eth1 DEVICE=eth1 #HWADDR=00:25:5d:A7:43:59 TYPE=Ethernet #UUID=1576f23c-ae2d-47a6-9231-ab1fd0c3b966 ONBOOT=yes NM_CONTROLLED=yes #BOOTPROTO=dhcp #禁止自动分配 BOOTPROTO=static #修改为静态IP IPADDR=192.168.28.128 NETMASK=255.255.255.0 GATEWAY=192.168.28.1 |
附:
环境:windows8.1,使用Hyper-V,在安装Centos5.8后发现网卡无法使用,而6.4正常。
操作:关掉虚拟机-选择设置-添加硬件-旧版网络适配器。然后应该就可以解决了
0 1 2 3 4 5 6 7 8 9 |
[root@byrd ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 # Digital Equipment Corporation DECchip 21140 [FasterNet] DEVICE=eth0 BOOTPROTO=none ONBOOT=yes HWADDR=00:25:5d:A7:43:59 NETMASK=255.255.255.0 IPADDR=192.168.1.158 GATEWAY=192.168.1.1 TYPE=Ethernet |
补充(2014年4月23日):
删除网卡重新安装网卡后,eth1网卡各种起不来,DEVICE=eth?各种改名都不行
0 1 2 |
[root@Rsync-Backup-Server ~]# cat /etc/udev/rules.d/70-persistent-net.rules # PCI device 0x1011:0x0009 (tulip) SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:85:0d:c7:83:29", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0" |
居然叫做eth0,修改为eth0以后。正常。SourceByrd's Weblog-https://note.t4x.org/system/hyperv-centos-network/
申明:本文由BYRD原创(基于Centos6.4 X64),未经许可禁止转载!
其他参考文档:http://oldboy.blog.51cto.com/2561410/1363853SourceByrd's Weblog-https://note.t4x.org/system/hyperv-centos-network/
SourceByrd's Weblog-https://note.t4x.org/system/hyperv-centos-network/
申明:除非注明Byrd's Blog内容均为原创,未经许可禁止转载!详情请阅读版权申明!