Use dhcp or dnsmasq as DHCP server in libvirt-based environment

Default dhcp and dnsmasq are conflict in a OS.
Just change to another if one failed.

yum install dhcp

/etc/sysconfig/dhcpd is no longer needed in RHEL-7. However, it is still working in other distributions. Just assign an IP to the interface which in the subnet you want dhcp serve.

[root@localhost ~]# vi /etc/sysconfig/dhcpd
DHCPDARGS="eth0 eth1";

[root@localhost ~]# yum -y install dhcp
[root@localhost ~]# vi /etc/dhcp/dhcpd.conf
# create new
# specify domain name
option domain-name "";
# specify name server's hostname or IP address
option domain-name-servers;
# default lease time
default-lease-time 600;
# max lease time
max-lease-time 7200;
# this DHCP server to be declared valid
# specify network address and subnet mask
subnet netmask {
    # specify the range of lease IP address
    range dynamic-bootp;
    # specify broadcast address
    option broadcast-address;
    # specify default gateway
    option routers;
[root@localhost ~]# systemctl start dhcpd 
[root@localhost ~]# systemctl enable dhcpd 
ln -s '/usr/lib/systemd/system/dhcpd.service' '/etc/systemd/system/'


Dnsmasq is very useful in libvirt/qemu/docker based environment.
To bind to interface br0(

/usr/sbin/dnsmasq --strict-order --pid-file=/var/run/libvirt/network/br0--conf-file= --except-interface lo --bind-interfaces br0 --listen-address --dhcp-range, --dhcp-leasefile=/var/lib/libvirt/dnsmasq/br0.leases --dhcp-lease-max=253 --dhcp-no-override --dhcp-hostsfile=/var/lib/libvirt/dnsmasq/br0.hostsfile --addn-hosts=/var/lib/libvirt/dnsmasq/br0.addnhosts