[libvirt-users] libvirt network without dns ?

Scott Moser smoser at ubuntu.com
Thu Sep 20 14:55:16 UTC 2012


Hey,
   I've opened a bug against ubuntu at [1]. I realize this is probably not
a high priority, but I was just curious if it is possible to have libvirt
configure a network and *not* run a DNS server on it (dnsmasq).  Perhaps I
could convince libvirt to run dnsmasq with '--port 0'?

   For my explicit use case i was hoping/expecting to run my own dns and
dhcp servers, possibly a specific server bound only to that interface (as
dnsmasq does).  I just wanted libvirt to create the bridge and setup NAT
(and automatically bring the network and any configured guests on it up on
boot).
   Heres what I did.
$ BRIDGE="mybr0"; IP="192.168.123.1";
$ cat > $BRIDGE.xml <<EOF
<network>
  <name>$BRIDGE</name>
  <forward mode='nat'/>
  <bridge name='$BRIDGE' stp='off' delay='0' />
  <ip address='$IP' netmask='255.255.255.0'>
  </ip>
</network>
EOF
$ sudo virsh -c qemu:///system net-define $BRIDGE.xml
$ sudo virsh -c qemu:///system net-start $BRIDGE

## See, after 'start' dnsmasq is running and usable on that interface.

$ ps axw | grep dnsm | grep $BRIDGE.pid
 9888 ? S 0:00 /usr/sbin/dnsmasq -u libvirt-dnsmasq --strict-order
--bind-interfaces --pid-file=/var/run/libvirt/network/mybr0.pid
--conf-file= --except-interface lo --listen-address 192.168.123.1
$ dig +short @$IP www.ubuntu.com
91.189.90.41

--
[1] https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1053408




More information about the libvirt-users mailing list