libvirt - dhcp not working

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

libvirt - dhcp not working

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

I want to use libvirt network nat configuration.

libvirt says (https://wiki.libvirt.org/page/Virtual_n ... 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

<network>
<name>default</name>
<uuid>b6ef8506-d4c7-4bba-9fe7-8f971ea87d10</uuid>
<forward mode='nat'>
<nat>
<port start='1024' end='65535'/>
</nat>
</forward>
<bridge name='virbr0' stp='on' delay='0'/>
<mac address='52:54:00:06:86:de'/>
<domain name='circus.net'/>
<ip address='192.168.122.1' netmask='255.255.255.0'>
<dhcp>
<range start='192.168.122.2' end='192.168.122.10'/>
</dhcp>
</ip>
</network>


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:
1.it 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”