I have re-built QEMU with VDE support. For the uninitiated, VDE attaches a virtual switch program (vde_switch) to a TAP device which allows multiple VDE-enabled programs to utilize a single TAP device.

My ultimate goal here is to be able to resolve my virtual machines by hostname such as "test1.qemu" "machineb.qemu", etc from my host -- this will ease configuration for me in many circumstances since I use DHCP via dnsmasq on the TAP interfaces.

Really this is probably a matter of not fully understanding how name resolution works, so I'm hoping to learn something out of this =)

Firstly, my dnsmasq configuration file:

#Assign IP's for 8 hrs
#Only really run on tap0, needed so there is no confliction with
#NetworkManager's dnsmasq

As you can see, I have configured dnsmasq to answer for "*.qemu" names. I can ping properly, but as is stands, 'ping qemu' doesn't work. I assumed this was because my host machine didn't know how to resolve 'qemu', so I added it to the /etc/hosts file. Though, I'm not sure this is the proper way to do this. Of course, after adding the entry to /etc/hosts, qemu resolves but not i386.qemu (one of my VM's).

I guess a good starting point would be: how do I tell my machine to forward all *.qemu requests to the dnsmasq running on (local interface tap0)?

Also, if it's any help, here is my /etc/network/interfaces entry for tap0:

auto tap0
iface tap0 inet static
    vde2-switch -
    pre-up /sbin/sysctl net.ipv4.ip_forward=1
    pre-up /sbin/iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
    up /usr/sbin/dnsmasq -C /etc/dnsmasq.d/vde-network --pid-file=/var/run/dnsmasq_tap0.pid --bind-interfaces
    post-down /bin/bash -c "kill -9 $(cat /var/run/dnsmasq_tap0.pid)"
    post-down /sbin/sysctl net.ipv4.ip_forward=0
    post-down /sbin/iptables -t nat -D POSTROUTING -o wlan0 -j MASQUERADE

1 Answer 1


So, I figured out the answer, and it was a bit of a facepalm moment.

I had a file called /etc/NetworkManager/dnsmasq.d/qemu which contained an incorrect DNS IP for my qemu dnsmasq instance ( rather than So, I think what was happening was that when I queried qemu, the default NetworkManager instance of netmask attempted to pass the query to which didn't work for obvious reasons.

Once I changed the address to in the config file and restarted NetworkManager (and thus its instance of dnamasq), everything works great! The /etc/hosts entry was not required as I had thought.

Now I just have to figure out how to resolve my VM host's hostname to my LAN address within my VM's rather than returning which is incorrect from my VMs' perspective.

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.