<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 02/25/2015 05:51 PM, Carlos Miranda
Molina (Mstaaravin) wrote:<br>
</div>
<blockquote
cite="mid:CACJp8-rL_-ZvK+XEOwd-NobreGToZoPS9=4xte8zYdY0Uud4mA@mail.gmail.com"
type="cite">
<div dir="ltr">Hello guys...
<div><br>
</div>
<div>I'm using libvirt in my local laboratory and I have a
question/problem about DNS settings over dnsmasq (by libvirt)</div>
<div><br>
</div>
<div>I have a NAT network separately from my real network, i
need simulated some DNS hosts to NAT network like <a
moz-do-not-send="true" href="http://ftp.debian.org">ftp.debian.org</a>
(for testing purposes, etc)</div>
<div><br>
</div>
<div>This is for example a dumpxml (yes, i'm using PXE boot for
testing and is working fine)</div>
<div><br>
</div>
<div>
<div><network></div>
<div> <name>net0</name></div>
<div>
<uuid>5a014735-f658-7a87-c7d4-e6b0f488c332</uuid></div>
<div> <forward mode='nat'/></div>
<div> <bridge name='net0' stp='on' delay='0'/></div>
<div> <mac address='52:54:00:b5:24:7b'/></div>
<div> <dns></div>
<div> <host ip='192.168.122.1'><br>
</div>
<div> <hostname><a moz-do-not-send="true"
href="http://mirrors.kernel.org">mirrors.kernel.org</a></hostname></div>
<div> <hostname><a moz-do-not-send="true"
href="http://mirrors.dcarsat.com.ar">mirrors.dcarsat.com.ar</a></hostname></div>
<div> <hostname><a moz-do-not-send="true"
href="http://ftp.debian.org">ftp.debian.org</a></hostname></div>
<div> </host><br>
</div>
<div> </dns><br>
</div>
<div> <ip address='192.168.122.1'
netmask='255.255.255.0'></div>
<div> <tftp root='/home/tftp'/></div>
<div> <dhcp></div>
<div> <range start='192.168.122.2'
end='192.168.122.99'/></div>
<div> <bootp file='pxelinux.0'/></div>
<div> </dhcp></div>
<div> </ip></div>
<div></network></div>
</div>
<div><br>
</div>
<div>Look <dns> & <hostname> section, that works
correctly but only if I add hostnames on net0 when was
offline.</div>
<div>
<div><br>
</div>
<div> <dns></div>
<div> <host ip='192.168.122.1'><br>
</div>
<div> <hostname><a moz-do-not-send="true"
href="http://mirrors.kernel.org">mirrors.kernel.org</a></hostname></div>
<div> <hostname><a moz-do-not-send="true"
href="http://mirrors.dcarsat.com.ar">mirrors.dcarsat.com.ar</a></hostname></div>
<div> <hostname><a moz-do-not-send="true"
href="http://ftp.debian.org">ftp.debian.org</a></hostname></div>
<div> </host><br>
</div>
<div> </dns></div>
</div>
<div><br>
</div>
<div><br>
</div>
<div>How i can add more hostnames with my network (net0) are
still online...?</div>
<div><br>
</div>
<div>virsh net-update default add-last dns-host (for example,
doesn't work)<br>
</div>
</div>
</blockquote>
<br>
It looks like support for that was added in libvirt 1.0.1. Can you
provide the entire commandline you use? In what way does it not
work? Note that in order to have it take effect immediately and be
saved in the persistent config for the network, you must specify
"--live --config" on the commandline. Also, you can only add and
remove entire <host> records, you can't add a <hostname>
into an existing <host>.<br>
<br>
For example, I just tried this command and it worked for me (note
that the outer single quotes around the xml, and use of double
quotes within):<br>
<br>
<br>
virsh net-update default add dns-host \<br>
'<host ip="192.168.122.145"><br>
<hostname>blah.laine.org</hostname><br>
<hostname>blorg.laine.org</hostname><br>
</host>' \<br>
--live --config<br>
<br>
When you enter this command, libvirt will rewrite the the file
/var/lib/libvirt/dnsmasq/default.addnhosts and send a SIGHUP to
dnsmasq (this is one of the few cases where dnsmasq is actually
willing/able to reread a config file without needing to quit and
restart the dnsmasq process).<br>
<br>
<br>
<blockquote
cite="mid:CACJp8-rL_-ZvK+XEOwd-NobreGToZoPS9=4xte8zYdY0Uud4mA@mail.gmail.com"
type="cite">
<div dir="ltr">
<div><br>
</div>
<div>and the official documentation @</div>
<div><a moz-do-not-send="true"
href="http://libvirt.org/formatnetwork.html#elementsAddress">http://libvirt.org/formatnetwork.html#elementsAddress</a><br>
</div>
<div>doesn't say more.<br>
</div>
<div><br>
</div>
<div>I test with <forwarder > but doesn't work </div>
<div>(192.168.10.100 is a dnsmasq outside libvirt control)</div>
</div>
</blockquote>
<br>
<forwarder> was added in libvirt version 1.1.3. What version
are you using? If it is high enough, have you looked at the DNS
server used by the guest to see if it has gotten it right and/or
tried doing a tcpdump of the DHCP exchange to see if the different
forwarder is sent in the response?<br>
<br>
<blockquote
cite="mid:CACJp8-rL_-ZvK+XEOwd-NobreGToZoPS9=4xte8zYdY0Uud4mA@mail.gmail.com"
type="cite">
<div dir="ltr">
<div><br>
</div>
<div>
<div><network></div>
<div> <name>net0</name></div>
<div>
<uuid>5a014735-f658-7a87-c7d4-e6b0f488c332</uuid></div>
<div> <forward mode='nat'/></div>
<div> <bridge name='net0' stp='on' delay='0'/></div>
<div> <mac address='52:54:00:b5:24:7b'/></div>
<div> <dns></div>
<div> <forwarder addr="192.168.10.100"/></div>
<div> </dns><br>
</div>
<div> <ip address='192.168.122.1'
netmask='255.255.255.0'></div>
<div> <tftp root='/home/tftp'/></div>
<div> <dhcp></div>
<div> <range start='192.168.122.2'
end='192.168.122.99'/></div>
<div> <bootp file='pxelinux.0'/></div>
<div> </dhcp></div>
<div> </ip></div>
<div></network></div>
</div>
<div><br>
</div>
<div>Anyone can help me...?</div>
<br>
</div>
</blockquote>
<br>
</body>
</html>