bridge – 没有为KVM VM分配IPv4地址

我在设置KVM时遇到问题. Ubuntu 10.10中的桥接网络.我正在通过virsh启动我的VM,之后我可以在主机上看到kvm进程和vnet设备,但是新接口永远不会获得IPv4地址,因此我无法使用VM!下面是VM启动后我可以看到的内容的读数.

root@robin-desktop:~# virsh start meerkat
Domain meerkat started

root@robin-desktop:~# ps aux | grep kvm
root      1411  0.0  0.0      0     0 ?        S    18:20   0:00 [kvm-irqfd-clean]
119       3436 73.7  3.5 1213320 141076 ?      Sl   18:48   0:05 /usr/bin/kvm -S -M pc-0.12 -enable-kvm -m 1024 -smp 1,sockets=1,cores=1,threads=1 -name meerkat -uuid dbf905dd-b05d-5c81-5fe4-ad421cd50ece -nographic -nodefaults -chardev socket,id=monitor,path=/var/lib/libvirt/qemu/meerkat.monitor,server,nowait -mon chardev=monitor,mode=readline -rtc base=utc -boot c -drive file=/home/robin/kvm/meerkat/ubuntu-kvm/tmp6pwohf.qcow2,if=none,id=drive-ide0-0-0,boot=on,format=qcow2 -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 -device virtio-net-pci,vlan=0,id=net0,mac=52:54:00:06:7e:9c,bus=pci.0,addr=0x3 -net tap,fd=40,vlan=0,name=hostnet0 -chardev pty,id=serial0 -device isa-serial,chardev=serial0 -usb -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4
root      3455  0.0  0.0  11340   872 pts/0    S+   18:49   0:00 grep --color=auto kvm
root@robin-desktop:~# 
root@robin-desktop:~# ifconfig 
br0       Link encap:Ethernet  HWaddr e0:cb:4e:bb:99:07  
          inet addr:192.168.1.15  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::e2cb:4eff:febb:9907/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2948 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2904 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:1285644 (1.2 MB)  TX bytes:612230 (612.2 KB)

eth0      Link encap:Ethernet  HWaddr e0:cb:4e:bb:99:07  
          inet6 addr: fe80::e2cb:4eff:febb:9907/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3835 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3845 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1817408 (1.8 MB)  TX bytes:785533 (785.5 KB)
          Interrupt:47 Base address:0x2000 

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:63 errors:0 dropped:0 overruns:0 frame:0
          TX packets:63 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:4869 (4.8 KB)  TX bytes:4869 (4.8 KB)

vnet0     Link encap:Ethernet  HWaddr fe:54:00:06:7e:9c  
          inet6 addr: fe80::fc54:ff:fe06:7e9c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:20 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500 
          RX bytes:0 (0.0 B)  TX bytes:4137 (4.1 KB)

root@robin-desktop:~#

挖掘一下,守护程序日志文件中可能有线索:

root@robin-desktop:~# tail -7 /var/log/daemon.log
Dec  1 18:48:55 robin-desktop NetworkManager[3342]:    SCPlugin-Ifupdown: devices added (path: /sys/devices/virtual/net/vnet0, iface: vnet0)
Dec  1 18:48:55 robin-desktop NetworkManager[3342]:    SCPlugin-Ifupdown: device added (path: /sys/devices/virtual/net/vnet0, iface: vnet0): no ifupdown configuration found.
Dec  1 18:48:55 robin-desktop NetworkManager[3342]: <warn> /sys/devices/virtual/net/vnet0: couldn't determine device driver; ignoring...
Dec  1 18:48:55 robin-desktop modem-manager: (net/vnet0): could not get port's parent device
Dec  1 18:48:56 robin-desktop avahi-daemon[3354]: Joining mDNS multicast group on interface vnet0.IPv6 with address fe80::fc54:ff:fe06:7e9c.
Dec  1 18:48:56 robin-desktop avahi-daemon[3354]: New relevant interface vnet0.IPv6 for mDNS.
Dec  1 18:48:56 robin-desktop avahi-daemon[3354]: Registering new address record for fe80::fc54:ff:fe06:7e9c on vnet0.*.

我已经尝试关闭avahi和网络管理器 – 没有区别.

有没有人有类似问题的经验?我在Ubuntu 9.10上运行了这些东西!

谢谢.

编辑:这里有一些brctl输出:

root @ robin-desktop:〜#brctl show

bridge name bridge id       STP enabled interfaces
br0     8000.e0cb4ebb9907   no      eth0
                            vnet0

编辑2:这是主机上的网络接口文件

robin@robin-desktop:~$cat /etc/network/interfaces 
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet manual

auto br0
iface br0 inet dhcp
        bridge_ports eth0
        bridge_stp off
        bridge_fd 0
        bridge_maxwait 0

我应该设置bridge_stp吗?

Edit3:这是libvirt xml配置,这最初是由ubuntu-vmbuilder创建的,我已经攻击了一下

<domain type='kvm'>
  <name>meerkat</name>
  <uuid>dbf905dd-b05d-5c81-5fe4-ad421cd50ece</uuid>
  <memory>1048576</memory>
  <currentMemory>1048576</currentMemory>
  <vcpu>1</vcpu>
  <os>
    <type arch='x86_64' machine='pc-0.12'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
  </features>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/bin/kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/home/robin/kvm/meerkat/ubuntu-kvm/tmp6pwohf.qcow2'/>
      <target dev='hda' bus='ide'/>
      <address type='drive' controller='0' bus='0' unit='0'/>
    </disk>
    <controller type='ide' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:06:7e:9c'/>
      <source bridge='br0'/>
      <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>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </memballoon>
  </devices>
</domain>
最佳答案
-A FORWARD -m physdev –physdev-is-bridged -j ACCEPT
在/ etc / sysconfig / iptales中,我添加此行以使kvm正常工作
我的

转载注明原文:bridge – 没有为KVM VM分配IPv4地址 - 代码日志