3

I am new to qemu networking and pretty confused about the following situation. I launched 5 VMs. Each connects to br0 through a tap device. I also have a dnsmasq listening on br0 for DHCP.

The problem is dnsmasq does not hand out ip to VM according to the dhcp_host file I specified. The dhcp_host file has entries like: mac:ip. I thought when I put the mac addr in qemu, the dnsmasq should look up the ip from the dhcp_host file. But it didn't. Instead, it hands out ip randomly.

Now, when I checked with brctl. It shows 10 mac addresses instead of 5!? I searched a lot of qemu networking tutorials from google before come to ask here. None of them answer my questions. Could someone please explain the situation or give me some pointers? Thanks!

 $ brctl show
 bridge name     bridge id               STP enabled     interfaces
 br0             8000.1ed7c974ed93       no               tap0
                                                          tap1
                                                          tap2
                                                          tap3
                                                          tap4
$ brctl showmacs br0
port no mac addr                is local?       ageing timer
  1     02:2f:ef:29:be:36       no                 1.73
  1     1e:d7:c9:74:ed:93       yes                0.00
  4     22:00:f4:a8:89:8a       no                 3.99
  5     5a:e6:2a:d6:a0:50       yes                0.00
  3     5e:18:64:12:3d:ec       yes                0.00
  3     72:22:53:51:f4:fa       no                 3.08
  4     7a:e4:22:89:59:9a       yes                0.00
  5     82:9f:d3:6d:54:17       no                 0.69
  2     c2:fb:2a:3a:81:e9       no                32.99
  2     e6:a6:7a:a4:49:d4       yes                0.00

UPDATE: Below is one sample qemu process info from ps aux

user     15983 99.9  8.0 5673100 5296180 ?     Sl   12:29 214:30 qemu-system-x86_64 
-enable-kvm -snapshot -no-shutdown 
-m 5120 -smp 2 
-pidfile /home/user/vm-workingdir/instance-2/pid 
-monitor unix:/home/htrc/user/instance-2/monitor,server,nowait 
-serial file:/home/user/vm-workingdir/instance-2/release_mon 
-usb 
-net nic,vlan=0,macaddr=c2:b3:04:4b:8c:c8 
-net tap,vlan=0,fd=3 
-hda /home/user/vm-workingdir/instance-2/image.img 
-vnc :105,password
  • can you show the domxml for the VMs (just the networking part), ifconfig and network configuration files? – dyasny Nov 17 '14 at 20:22
  • where do I get the domxml? I create vm through qemu command, not through libvirt. – helloworld Nov 17 '14 at 20:58
  • oh, well then, ps -ef |grep qemu – dyasny Nov 18 '14 at 1:44
  • ok, see updates in the post. – helloworld Nov 18 '14 at 2:09
  • Don't you need a MAC address on both sides of your bridge? – NickW Nov 18 '14 at 15:45
3

The tap device's mac and the actual mac of the virtual NIC in the VM are different, this is why you see double the amount of MACs in the output.

You should only look at the VM's internal MACs, the ones you specify in the -net nic,vlan=0,macaddr=XX:XX... argument, the tap dev MACs aren't important.

  • If I understand correctly, the tap has one mac addr, the VM NIC has another mac, so that is why brctl show two mac addrs for one VM. – helloworld Nov 18 '14 at 21:01
  • The flow looks like br0-NIC <===> Tap-NIC <===> VM-NIC. True? So that means the Tap is hooked to the bridge. True? – helloworld Nov 18 '14 at 21:04
  • 1
    yes, the tap is hooked into the bridge, and the VM (qemu) to the tap. BTW, note how libvirt uses macs that look like "FE:xx:xx:..." for the tap macs - this is on purpose, so that a starting VM's mac doesn't overwrite the bridge's mac, which can happen if the upcoming MAC value is lower than the bridge's. This will cause a network outage until arp is refreshed on the switch. – dyasny Nov 18 '14 at 21:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.