mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-05 05:45:46 +00:00
network: add dnsmasq option 'dhcp-authoritative'
The dnsmasq man page recommends that dhcp-authoritative "should be set when dnsmasq is definitely the only DHCP server on a network". This is the case for libvirt-managed virtual networks. The effect of this is that VMs that fail to renew their DHCP lease in time (e.g. if the VM or host is suspended) will be able to re-acquire the lease even if it's expired, unless the IP address has been taken by some other host. This avoids various annoyances caused by changing VM IP addresses.
This commit is contained in:
parent
77d24de674
commit
4ac20b3ae4
@ -1258,8 +1258,10 @@ networkDnsmasqConfContents(virNetworkObjPtr network,
|
|||||||
|
|
||||||
/* Note: the following is IPv4 only */
|
/* Note: the following is IPv4 only */
|
||||||
if (VIR_SOCKET_ADDR_IS_FAMILY(&ipdef->address, AF_INET)) {
|
if (VIR_SOCKET_ADDR_IS_FAMILY(&ipdef->address, AF_INET)) {
|
||||||
if (ipdef->nranges || ipdef->nhosts)
|
if (ipdef->nranges || ipdef->nhosts) {
|
||||||
virBufferAddLit(&configbuf, "dhcp-no-override\n");
|
virBufferAddLit(&configbuf, "dhcp-no-override\n");
|
||||||
|
virBufferAddLit(&configbuf, "dhcp-authoritative\n");
|
||||||
|
}
|
||||||
|
|
||||||
if (ipdef->tftproot) {
|
if (ipdef->tftproot) {
|
||||||
virBufferAddLit(&configbuf, "enable-tftp\n");
|
virBufferAddLit(&configbuf, "enable-tftp\n");
|
||||||
|
@ -10,6 +10,7 @@ bind-dynamic
|
|||||||
interface=virbr0
|
interface=virbr0
|
||||||
dhcp-range=192.168.122.2,192.168.122.254
|
dhcp-range=192.168.122.2,192.168.122.254
|
||||||
dhcp-no-override
|
dhcp-no-override
|
||||||
|
dhcp-authoritative
|
||||||
dhcp-range=2001:db8:ac10:fd01::1:10,2001:db8:ac10:fd01::1:ff,64
|
dhcp-range=2001:db8:ac10:fd01::1:10,2001:db8:ac10:fd01::1:ff,64
|
||||||
dhcp-lease-max=493
|
dhcp-lease-max=493
|
||||||
dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
|
dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
|
||||||
|
@ -10,6 +10,7 @@ bind-dynamic
|
|||||||
interface=virbr1
|
interface=virbr1
|
||||||
dhcp-range=192.168.122.1,static
|
dhcp-range=192.168.122.1,static
|
||||||
dhcp-no-override
|
dhcp-no-override
|
||||||
|
dhcp-authoritative
|
||||||
dhcp-range=2001:db8:ac10:fd01::1,static,64
|
dhcp-range=2001:db8:ac10:fd01::1,static,64
|
||||||
dhcp-hostsfile=/var/lib/libvirt/dnsmasq/local.hostsfile
|
dhcp-hostsfile=/var/lib/libvirt/dnsmasq/local.hostsfile
|
||||||
addn-hosts=/var/lib/libvirt/dnsmasq/local.addnhosts
|
addn-hosts=/var/lib/libvirt/dnsmasq/local.addnhosts
|
||||||
|
@ -12,6 +12,7 @@ dhcp-option=3
|
|||||||
no-resolv
|
no-resolv
|
||||||
dhcp-range=192.168.152.2,192.168.152.254
|
dhcp-range=192.168.152.2,192.168.152.254
|
||||||
dhcp-no-override
|
dhcp-no-override
|
||||||
|
dhcp-authoritative
|
||||||
dhcp-lease-max=253
|
dhcp-lease-max=253
|
||||||
dhcp-hostsfile=/var/lib/libvirt/dnsmasq/private.hostsfile
|
dhcp-hostsfile=/var/lib/libvirt/dnsmasq/private.hostsfile
|
||||||
addn-hosts=/var/lib/libvirt/dnsmasq/private.addnhosts
|
addn-hosts=/var/lib/libvirt/dnsmasq/private.addnhosts
|
||||||
|
@ -15,6 +15,7 @@ listen-address=10.24.10.1
|
|||||||
srv-host=_name._tcp
|
srv-host=_name._tcp
|
||||||
dhcp-range=192.168.122.2,192.168.122.254
|
dhcp-range=192.168.122.2,192.168.122.254
|
||||||
dhcp-no-override
|
dhcp-no-override
|
||||||
|
dhcp-authoritative
|
||||||
dhcp-lease-max=253
|
dhcp-lease-max=253
|
||||||
dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
|
dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
|
||||||
addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
|
addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
|
||||||
|
@ -17,6 +17,7 @@ srv-host=_name6._tcp.test6.com,test6.example.com,6666,0,666
|
|||||||
srv-host=_name7._tcp.test7.com,test7.example.com,1,0,777
|
srv-host=_name7._tcp.test7.com,test7.example.com,1,0,777
|
||||||
dhcp-range=192.168.122.2,192.168.122.254
|
dhcp-range=192.168.122.2,192.168.122.254
|
||||||
dhcp-no-override
|
dhcp-no-override
|
||||||
|
dhcp-authoritative
|
||||||
dhcp-lease-max=253
|
dhcp-lease-max=253
|
||||||
dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
|
dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
|
||||||
addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
|
addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
|
||||||
|
@ -11,6 +11,7 @@ interface=virbr0
|
|||||||
txt-record=example,example value
|
txt-record=example,example value
|
||||||
dhcp-range=192.168.122.2,192.168.122.254
|
dhcp-range=192.168.122.2,192.168.122.254
|
||||||
dhcp-no-override
|
dhcp-no-override
|
||||||
|
dhcp-authoritative
|
||||||
dhcp-lease-max=253
|
dhcp-lease-max=253
|
||||||
dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
|
dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
|
||||||
addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
|
addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
|
||||||
|
@ -15,6 +15,7 @@ listen-address=10.24.10.1
|
|||||||
srv-host=_name._tcp
|
srv-host=_name._tcp
|
||||||
dhcp-range=192.168.122.2,192.168.122.254
|
dhcp-range=192.168.122.2,192.168.122.254
|
||||||
dhcp-no-override
|
dhcp-no-override
|
||||||
|
dhcp-authoritative
|
||||||
dhcp-lease-max=253
|
dhcp-lease-max=253
|
||||||
dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default"with"quotes".hostsfile
|
dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default"with"quotes".hostsfile
|
||||||
addn-hosts=/var/lib/libvirt/dnsmasq/default"with"quotes".addnhosts
|
addn-hosts=/var/lib/libvirt/dnsmasq/default"with"quotes".addnhosts
|
||||||
|
@ -10,6 +10,7 @@ bind-dynamic
|
|||||||
interface=virbr0
|
interface=virbr0
|
||||||
dhcp-range=192.168.122.2,192.168.122.254
|
dhcp-range=192.168.122.2,192.168.122.254
|
||||||
dhcp-no-override
|
dhcp-no-override
|
||||||
|
dhcp-authoritative
|
||||||
dhcp-lease-max=253
|
dhcp-lease-max=253
|
||||||
dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
|
dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
|
||||||
addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
|
addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
|
||||||
|
@ -12,6 +12,7 @@ bind-interfaces
|
|||||||
listen-address=192.168.122.1
|
listen-address=192.168.122.1
|
||||||
dhcp-range=192.168.122.2,192.168.122.254
|
dhcp-range=192.168.122.2,192.168.122.254
|
||||||
dhcp-no-override
|
dhcp-no-override
|
||||||
|
dhcp-authoritative
|
||||||
enable-tftp
|
enable-tftp
|
||||||
tftp-root=/var/lib/tftproot
|
tftp-root=/var/lib/tftproot
|
||||||
dhcp-boot=pxeboot.img
|
dhcp-boot=pxeboot.img
|
||||||
|
@ -12,6 +12,7 @@ bind-interfaces
|
|||||||
listen-address=192.168.122.1
|
listen-address=192.168.122.1
|
||||||
dhcp-range=192.168.122.2,192.168.122.254
|
dhcp-range=192.168.122.2,192.168.122.254
|
||||||
dhcp-no-override
|
dhcp-no-override
|
||||||
|
dhcp-authoritative
|
||||||
dhcp-boot=pxeboot.img,,10.20.30.40
|
dhcp-boot=pxeboot.img,,10.20.30.40
|
||||||
dhcp-lease-max=253
|
dhcp-lease-max=253
|
||||||
dhcp-hostsfile=/var/lib/libvirt/dnsmasq/netboot.hostsfile
|
dhcp-hostsfile=/var/lib/libvirt/dnsmasq/netboot.hostsfile
|
||||||
|
Loading…
Reference in New Issue
Block a user