3. DHCP Configuration
To enable management of DHCP by cobbler change the following setting in
/etc/cobbler/settings
:
manage_dhcp: 1
and restart the cobblerd
service.
When you run cobbler sync
, cobbler will generate a new
/etc/dhcp/dhcpd.conf
file and reload the dhcpd
service.
Cobbler manages DHCP by giving you automation where useful, while giving
you full control of what it does. It does so by using configuration file
templates. When running cobbler sync
these templates are used to
generate a configuration file and then reload the services.
The cobbler template for dhcpd
is /etc/cobbler/dhcp.template
.
Look at its contents, run cobbler sync
and verify how that template is rendered by looking at the
generated /etc/dhcp/dhcpd.conf
. It should look something like this:
Note
The cobbler sync
command will fail with an error, since the default
configuration seen below is not valid for us. This is normal.
# ******************************************************************
# Cobbler managed dhcpd.conf file
# generated from cobbler dhcp.conf template
# Do NOT make changes to /etc/dhcpd.conf. Instead, make your changes
# in /etc/cobbler/dhcp.template, as /etc/dhcpd.conf will be
# overwritten.
# ******************************************************************
ddns-update-style interim;
allow booting;
allow bootp;
ignore client-updates;
set vendorclass = option vendor-class-identifier;
option pxe-system-type code 93 = unsigned integer 16;
subnet 192.168.1.0 netmask 255.255.255.0 {
option routers 192.168.1.5;
option domain-name-servers 192.168.1.1;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.1.100 192.168.1.254;
default-lease-time 21600;
max-lease-time 43200;
next-server 192.168.16.1;
class "pxeclients" {
match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
if option pxe-system-type = 00:02 {
filename "ia64/elilo.efi";
} else if option pxe-system-type = 00:06 {
filename "grub/grub-x86.efi";
} else if option pxe-system-type = 00:07
filename "grub/grub-x86_64.efi";
} else if option pxe-system-type = 00:09 {
filename "grub/grub-x86_64.efi";
} else {
filename "pxelinux.0";
}
}
}
# group for Cobbler DHCP tag: default
group {
}
Modify the template in /etc/cobbler/dhcp.template
to include
both our management and cluster subnets. Note that we only need the pxeclients
part in the cluster network.
Warning
Make sure to remove range dynamic-bootp 192.168.1.100 192.168.1.254
from
the template and adjust all other subnet parameters to match the ones we had in
Exercise 2.
Leave other parts of the configuration file alone. Do not add
host
sections. These will be added automatically later.
Run cobbler sync
to update your DHCP configuration.
Your final generated DHCP configuration should have the following structure:
# ******************************************************************
# Cobbler managed dhcpd.conf file
# generated from cobbler dhcp.conf template
# Do NOT make changes to /etc/dhcpd.conf. Instead, make your changes
# in /etc/cobbler/dhcp.template, as /etc/dhcpd.conf will be
# overwritten.
# ******************************************************************
ddns-update-style interim;
allow booting;
allow bootp;
ignore client-updates;
set vendorclass = option vendor-class-identifier;
option pxe-system-type code 93 = unsigned integer 16;
subnet 192.168.0.0 netmask 255.255.240.0 {
...
}
subnet 192.168.16.0 netmask 255.255.240.0 {
...
}
# group for Cobbler DHCP tag: default
group {
}