Hi all, how I can set dhcp options as DNS, gateway, etc in libvirt's network definitions? From what I read here[1], I can use the <option> tag. However, I can not find nothing on libvirt official documentation. I am missing something? Thanks. [1] https://www.redhat.com/archives/libvir-list/2013-March/msg00166.html -- Danti Gionatan Supporto Tecnico Assyoma S.r.l. - www.assyoma.it email: g.danti@assyoma.it - info@assyoma.it GPG public key ID: FF5F32A8
Michal Privoznik
2018-Mar-13 14:30 UTC
Re: [libvirt-users] Specify DNS and gateway for dnsmasq
On 03/12/2018 06:45 PM, Gionatan Danti wrote:> Hi all, > how I can set dhcp options as DNS, gateway, etc in libvirt's network > definitions?The default GW depends on the IP address you assigned to your network: <ip address='192.168.122.1' netmask='255.255.255.0'/> This says the default GW is 192.168.122.1/24. However, you can insert other routes too: <route address="192.168.222.0" prefix="24" gateway="192.168.122.2"/> For handling DNS, you need to focus on <dns/> element. For instance, to set a different forwarder than GW: <dns> <forwarder addr="8.8.8.8"/> </dns> It's all documented here: https://libvirt.org/formatnetwork.html#elementsStaticroute and in the subsequent section.> > From what I read here[1], I can use the <option> tag. However, I can not > find nothing on libvirt official documentation.No, that was just a proposal. RFC, a discussion how should we implement some special features of DHCP. Those are not patches and in fact patches implementing that were never merged. Michal
Gionatan Danti
2018-Mar-13 15:08 UTC
Re: [libvirt-users] Specify DNS and gateway for dnsmasq
On 13/03/2018 15:30, Michal Privoznik wrote:> The default GW depends on the IP address you assigned to your network:> > <ip address='192.168.122.1' netmask='255.255.255.0'/> > > This says the default GW is 192.168.122.1/24. However, you can insert > other routes too: > > <route address="192.168.222.0" prefix="24" gateway="192.168.122.2"/> > > For handling DNS, you need to focus on <dns/> element. For instance, to > set a different forwarder than GW: > > <dns> > <forwarder addr="8.8.8.8"/> > </dns>For NATed/routed networks, sure. However, I have an isolated network like that (without the "forward" element): <network> <name>net1</name> <uuid>dcf5c09b-dcb6-4fd3-86b8-6312a7b94bf6</uuid> <bridge name='virbr1' stp='on' delay='0'/> <mac address='52:54:00:97:1b:15'/> <domain name='TEST'/> <ip address='192.168.10.1' netmask='255.255.255.0'> <dhcp> <range start='192.168.10.128' end='192.168.10.254'/> </dhcp> </ip> </network> When the client asks for an IP via DHCP, it obtain a valid IP address but *no* gateway. Is it the expected behavior for an isolated network? From my understanding, network isolation is accomplished by firewall rules in the FORWARD table, rather than by not assigning the gateway IP address to clients.> > No, that was just a proposal. RFC, a discussion how should we implement > some special features of DHCP. Those are not patches and in fact patches > implementing that were never merged. > > Michal >Ok, thank you Michal. -- Danti Gionatan Supporto Tecnico Assyoma S.r.l. - www.assyoma.it email: g.danti@assyoma.it - info@assyoma.it GPG public key ID: FF5F32A8