为什么在使用TAP接口启动KVM虚拟机时会出现权限错误



1st Post,感谢社区。如果它更适合在另一个论坛道歉

我正在运行Ubuntu 12.04 LTS服务器作为我的主机。

/etc/libvirt#kvm——版本

QEMU模拟器1.0版(QEMU-kmm-1.0),版权所有(c)2003-2008 Fabrice Bellard

我构建了一个运行Ubuntu 13.10的虚拟机。当我进入XML为静态IP配置以太网tap0接口时,我遇到了麻烦。我翻遍了网,试了好几种方法,都没有用。

这是我得到的错误
错误下面是我的配置和日志
下面是我尝试过但没有成功的事情清单。。。

-#virsh启动phabVM错误:无法启动域phabVM错误:内部错误读取控制台日志输出时进程退出:char设备重定向到/dev/pts/1kvm:-netdev-tap,ifname=tap0,id=hostnet0:无法打开/dev/net/tun:不允许操作kvm:-netdev-tap,ifname=tap0,id=hostnet0:无法初始化设备"tap"


VM XML

    # domain type='kvm'>
    # name>phabVM
    # uuid>26a54ab3-7c67-507b-f066-09015dd19942
    # memory>4194304
    # currentMemory>4194304
    # vcpu>1
    # os>
    # type arch='x86_64' machine='pc-1.0'>hvm
    # boot dev='hd'/>
    # /os>
    # features>
    # acpi/>
    # apic/>
    # pae/>
    # /features>
    # clock offset='utc'/>
    # on_poweroff>preserve
    # on_reboot>restart
    # on_crash>restart
    # devices>
    # emulator>/usr/bin/kvm
    # disk type='file' device='disk'>
    # driver name='qemu' type='raw'/>
    # source file='/home/inevirt/images/PhabVM.img'/>
    # target dev='sda' bus='sata'/>
    # address type='drive' controller='0' bus='0' unit='0'/>
    # /disk>
    # disk type='block' device='cdrom'>
    # driver name='qemu' type='raw'/>
    # target dev='hdc' bus='ide'/>
    # readonly/>
    # address type='drive' controller='0' bus='1' unit='0'/>
    # /disk>
    # controller type='ide' index='0'>
    # address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    # /controller>
    # controller type='sata' index='0'>
    # address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    # /controller>
    # interface type='ethernet'>
    # mac address='52:54:00:6d:ab:17'/>
    # target dev='tap0'/>
    # model type='virtio'/>
    # address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    # /interface>
    # serial type='pty'>
    # target port='0'/>
    # /serial>
    # console type='pty'>
    # target type='serial' port='0'/>
    # /console>
    # input type='mouse' bus='ps2'/>
    # graphics type='vnc' port='-1' autoport='yes'/>
    # sound model='ich6'>
    # address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    # /sound>
    # video>
    # model type='cirrus' vram='9216' heads='1'/>
    # address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    # /video>
    # memballoon model='virtio'>
    # address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    # /memballoon>
    # /devices>
    #/domain

日志

2013-11-21 17:38:59.075+0000: starting up
LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin        QEMU_AUDIO_DRV=none /usr/bin/kvm -S -M pc-1.0 -enable-kvm -m 4096 -smp 1,sockets=1,cores=1,threads=1 -name PhabVM -uuid 26a54ab3-7c67-507b-f066-09015dd19942 -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/PhabVM.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -device ahci,id=ahci0,bus=pci.0,addr=0x5 -drive file=/home/inevirt/images/PhabVM.img,if=none,id=drive-sata0-0-0,format=raw -device ide-drive,bus=ahci0.0,drive=drive-sata0-0-0,id=sata0-0-0,bootindex=1 -drive if=none,media=cdrom,id=drive-ide0-1-0,readonly=on,format=raw -device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 -netdev tap,ifname=tap0,id=hostnet0 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:6d:ab:17,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -usb -vnc 127.0.0.1:0 -vga cirrus -device intel-hda,id=sound0,bus=pci.0,addr=0x4 -device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6
char device redirected to /dev/pts/1
kvm: -netdev tap,ifname=tap0,id=hostnet0: could not open /dev/net/tun: Operation not permitted
kvm: -netdev tap,ifname=tap0,id=hostnet0: Device 'tap' could not be initialized
2013-11-21 17:38:59.205+0000: shutting down
2013-11-21 17:40:57.554+0000: starting up
LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin QEMU_AUDIO_DRV=none /usr/bin/kvm -S -M pc-1.0 -enable-kvm -m 4096 -smp 1,sockets=1,cores=1,threads=1 -name PhabVM -uuid 26a54ab3-7c67-507b-f066-09015dd19942 -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/PhabVM.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -device ahci,id=ahci0,bus=pci.0,addr=0x5 -drive file=/home/inevirt/images/PhabVM.img,if=none,id=drive-sata0-0-0,format=raw -device ide-drive,bus=ahci0.0,drive=drive-sata0-0-0,id=sata0-0-0,bootindex=1 -drive if=none,media=cdrom,id=drive-ide0-1-0,readonly=on,format=raw -device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 -netdev tap,ifname=tap0,id=hostnet0 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:6d:ab:17,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -usb -vnc 127.0.0.1:0 -vga cirrus -device intel-hda,id=sound0,bus=pci.0,addr=0x4 -device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6
char device redirected to /dev/pts/1
kvm: -netdev tap,ifname=tap0,id=hostnet0: could not open /dev/net/tun: Operation not permitted
kvm: -netdev tap,ifname=tap0,id=hostnet0: Device 'tap' could not be initialized
2013-11-21 17:40:57.686+0000: shutting down

我(从互联网研究中)尝试过的事情都没有奏效

已将用户添加到组kvm
配置libvirtd.conf并取消注释listen_tls和listen_tcp
通过将root设置为运行VM的用户/组来配置qemu.conf;未注释的
clear_emulator_capabilities=0
残疾人服装
确保kvm二进制设置为kvm组

尽量不要使用<interface type="ethernet">,对于更安全、更易于管理的网络接口,还有很多不同的可能性。如果您确实需要使用以太网类型的接口,那么您可以按照libvirt wiki页面了解这个问题,但我必须强调,我不建议这样做。

最新更新