libvirt - dhcp not working

Issues related to configuring your network
Post Reply
Posts: 3
Joined: 2020/01/24 22:38:36
Location: france

libvirt - dhcp not working

Post by achille » 2020/01/28 14:09:07

I want to use libvirt network nat configuration.

libvirt says ( ... en_started):

"1) If you're not actually using dnsmasq on the physical machine to serve DHCP for the *physical network*, you should just disable dnsmasq completely"

that corresponds to my context, so I stop completely dnsmasq in the host system.

in qemu system:

virsh # net-edit default

<forward mode='nat'>
<port start='1024' end='65535'/>
<bridge name='virbr0' stp='on' delay='0'/>
<mac address='52:54:00:06:86:de'/>
<domain name=''/>
<ip address='' netmask=''>
<range start='' end=''/>

virsh # net-start default
Network default started

virsh # net-list
Name State Autostart Persistent
default active no yes

I start guests S0 and S1

virsh # start S0
Domain S0 started

virsh # start S1
Domain S1 started

virsh # list
Id Name State
1 S0 running
2 S1 running

but dhcp does not seem to work:

virsh # net-dhcp-leases default
Expiry Time MAC address Protocol IP address Hostname Client ID or DUID

on the host machine:
ping: S1: Name or service not known

what I have tried:
virsh # shutdown S0
virsh # shutdown S1
virsh # net-destroy default

virsh # net-start default

on the host:
tcpdump -i virbr0

in qemu:
virsh # start S0
virsh # start S1

tcpdump does not see anything coming to virbr0

my question is: how to have dhcp working in this case?
additional questions: is said, in libvirt, nat conf should work out ot the box (default conf), nothing to do. what does 'out of the box' mean exactly? both S1 and S0 here have fqdn set to localhost.localdomain , so how libvirt dhcp make the distinction between S0 & S1?
2.If I want to customize my dnsmasq config (for instance, sthg like log-facility=/var/log/dnsmasq.log), where is the conf file? not in /etc/dnsmasq.conf or in /etc/dnsmasq.d/anyname.conf as dnsmasq does not work on the host?

thanx folks!

Post Reply

Return to “CentOS 8 - Networking Support”