I’m using KVM via Qemu via libvirt with Fedora 30 for the host machine. I find that a VM connected via NAT requests DHCP request about every 20~25 minutes, and I want to change the DHCP lease (or request?) time longer.
My problem is exactly the same as the one mentioned here https://stackoverflow.com/questions/40309451/how-to-change-libvirt-dhcp-lease-time
A patch for this feature has been requested here https://www.redhat.com/archives/libvir-list/2016-October/msg00561.html Can someone please tell me the status of that patch request? That’s not something I know how to do yet.
In case anyone is wondering why am I duplicating question here. It’s because I’m hoping the Fedora community would be more helpful than stackoverflow community.
vgaetera
(Vladislav Grigoryev)
September 4, 2019, 10:33am
2
It is not merged with the master and not supported in Fedora 30.
Possible solutions:
Static address.
External DHCP server with bridging or macvtap .
Custom DHCP instance instead of the default one.
2 Likes
@vgaetera Hello,
I tried making the IP address of the virtual machine static but it’s still not working.
Sep 16 23:31:10 localhost.localdomain dnsmasq-dhcp[1918]: DHCPDISCOVER(virbr1) 192.168.122.248 52:54:00:55:23:80
Sep 16 23:31:10 localhost.localdomain dnsmasq-dhcp[1918]: DHCPOFFER(virbr1) 192.168.1.128 52:54:00:55:23:80
Sep 16 23:31:10 localhost.localdomain dnsmasq-dhcp[1918]: DHCPREQUEST(virbr1) 192.168.1.128 52:54:00:55:23:80
Sep 16 23:31:10 localhost.localdomain dnsmasq-dhcp[1918]: DHCPACK(virbr1) 192.168.1.128 52:54:00:55:23:80 win2k19
Sep 17 00:01:09 localhost.localdomain dnsmasq-dhcp[1918]: DHCPREQUEST(virbr1) 192.168.1.128 52:54:00:55:23:80
Sep 17 00:01:09 localhost.localdomain dnsmasq-dhcp[1918]: DHCPACK(virbr1) 192.168.1.128 52:54:00:55:23:80 win2k19
Sep 17 00:28:32 localhost.localdomain dnsmasq-dhcp[1918]: DHCPREQUEST(virbr1) 192.168.1.128 52:54:00:55:23:80
Sep 17 00:28:32 localhost.localdomain dnsmasq-dhcp[1918]: DHCPACK(virbr1) 192.168.1.128 52:54:00:55:23:80 win2k19
Sep 17 00:56:10 localhost.localdomain dnsmasq-dhcp[1918]: DHCPREQUEST(virbr1) 192.168.1.128 52:54:00:55:23:80
Sep 17 00:56:10 localhost.localdomain dnsmasq-dhcp[1918]: DHCPACK(virbr1) 192.168.1.128 52:54:00:55:23:80 win2k19
Sep 17 01:23:04 localhost.localdomain dnsmasq-dhcp[1918]: DHCPREQUEST(virbr1) 192.168.1.128 52:54:00:55:23:80
Sep 17 01:23:04 localhost.localdomain dnsmasq-dhcp[1918]: DHCPACK(virbr1) 192.168.1.128 52:54:00:55:23:80 win2k19
The instructions I used for setting the IP address of the virtual machine to static is https://www.cyberciti.biz/faq/linux-kvm-libvirt-dnsmasq-dhcp-static-ip-address-configuration-for-guest-os/
Doing “sudo virsh net-list” gives me,
Name State Autostart Persistent
---------------------------------------------
default active yes yes
ProxyARP active yes yes
Doing “sudo virsh net-dumpxml ProxyARP” gives me,
<network>
<name>ProxyARP</name>
<uuid>7f378b15-ad13-420e-a317-3465ef2841e0</uuid>
<forward dev='wlp3s0' mode='route'>
<interface dev='wlp3s0'/>
</forward>
<bridge name='virbr1' stp='on' delay='0'/>
<mac address='52:54:00:cd:39:17'/>
<domain name='ProxyARP'/>
<ip address='192.168.1.1' netmask='255.255.255.0'>
<dhcp>
<range start='192.168.1.128' end='192.168.1.254'/>
<host mac='52:54:00:55:23:80' name='win2k19' ip='192.168.1.128'/>
</dhcp>
</ip>
</network>
The network segment of the virtual machines XML dump from doing “sudo virsh dumpxml win2k19” is,
<interface type='network'>
<mac address='52:54:00:55:23:80'/>
<source network='ProxyARP'/>
<model type='e1000e'/>
<address type='pci' domain='0x0000' bus='0x0b' slot='0x00' function='0x0'/>
</interface>
1 Like
vgaetera
(Vladislav Grigoryev)
September 17, 2019, 12:28am
4
I mean that you can completely disable DHCP or just ignore it and configure a static IP address in the VM.