centos6下KVM安裝及虛機網卡問題解決

來源:互聯網
上載者:User

The kernel component of KVM is included in mainline Linux, as of 2.6.20.

1、查看系統是否硬體虛擬化
# egrep 'vmx|svm' /proc/cpuinfo

2. 安裝KVM及其組件
yum -y install qemu-kvm libvirt python-virtinst bridge-utils virt-manager
yum groupinstall Virtualization
yum groupinstall "Virtualization Platform"

# lsmod | grep kvm

# /etc/init.d/libvirtd restart

建立橋接
cp ifcfg-eth0 ifcfg-br0

# cat ifcfg-eth0
DEVICE=eth0
BOOTPROTO=none
HWADDR=00:1d:09:66:e1:f8
IPV6INIT=no
MTU=1500
NM_CONTROLLED=no
ONBOOT=yes
TYPE=Ethernet
UUID="dacbb334-5792-4969-889a-907245adbd80"
IPADDR=192.168.100.210
NETMASK=255.255.255.0
GATEWAY=192.168.100.1
DNS1=8.8.8.8
USERCTL=no
BRIDGE=br0 ###添加關鍵一行

# cat ifcfg-br0
DEVICE=br0 ###修改關鍵行
BOOTPROTO=none
HWADDR=00:1d:09:66:e1:f8
IPV6INIT=no
MTU=1500
NM_CONTROLLED=no
ONBOOT=yes
TYPE=Bridge ###修改關鍵行
UUID="dacbb334-5792-4969-889a-907245adbd80"
IPADDR=192.168.100.210
NETMASK=255.255.255.0
GATEWAY=192.168.100.1
DNS1=8.8.8.8
USERCTL=no

問題:
使用kvm複製的虛機把源機的mac地址也一併複製了,在啟動複製機時,網卡無法啟用,提示如下:
device eth0 does not seem to be present,delaying initialization

原因:因mac地址重複,複製機把eth0重新命名成eth1了
解決:
1、列出識別的當前網卡列表
# ls /sys/class/net
eth1 lo

2、刪除第一條SUBSYSTEM,把原第二條SUBSYSTEM的NAME="eth1"修改為NAME="eth0"
#vim /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 0x15ad:0x07b0 (vmxnet3) (custom name provided by external tool)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:bc:00:45", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x15ad:0x07b0 (vmxnet3)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:bc:00:46", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

3、修改網卡eth0的設定檔的mac地址HWADDR為修改後70-persistent-net.rules中的mac地址
#vim /etc/sysconfig/network-scripts/ifcfg-eth0

4、reboot.

參考:http://www.ryanchapin.com/fv-b-4-655/Cloned-VMware-CentOS6-Server-and--quot-device-eth0-does-not-seem-to-be-present--delaying-initialization-

quot--Error-.html

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.