Set up your DHCP server

Create a new VM in Virt-Manager using QEMU/KVM:
CentOS 7
1024MB RAM, 1 CPU
Create disk as desired, I normally use 20G qcow2
Make sure you select your isolated NAT virtual network on Step 5!

Set static IP and bring up interface (my /etc/sysconfig/network-scripts/ifcfg-eth0 listed – NOTE: ensure the gateway and network match the network config from the last step!):

TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
PEERDNS=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME=eth0
UUID=******
DEVICE=eth0
ONBOOT=yes
IPADDR=192.168.100.2
NETMASK=255.255.255.0
BROADCAST=192.168.100.255
NETWORK=192.168.100.0
GATEWAY=192.168.100.1
DNS1=8.8.8.8

Update via yum as normal and reboot

yum update
reboot

Install DHCP server:

yum install dhcp

Configure /etc/dhcp/dhcpd.conf (mine listed):

option domain-name "mpd.local";
option domain-name-servers 8.8.8.8;
default-lease-time 600;
max-lease-time 7200;
authoritative;
subnet 192.168.100.0 netmask 255.255.255.0 {
  range 192.168.100.100 192.168.100.150;
  option routers 192.168.100.1;
  class "pxeclients" {
    match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
    next-server 192.168.100.2;
    filename "pxelinux/pxelinux.0";
  }
}

Enable and start your dhcpd service:

systemctl enable dhcpd
systemctl start dhcpd

Verify it is running:

systemctl status dhcpd | grep Active

Leave a Reply

Don't like what I say? Leave!