/etc/dhcpd.conf: Explanation & Insights

The /etc/dhcpd.conf file is the configuration file for the DHCP (Dynamic Host Configuration Protocol) server in Unix-like operating systems. It defines the parameters and settings used by the DHCP server to assign IP addresses and other network configuration information to DHCP clients.

Here are some examples of settings that can be specified in the /etc/dhcpd.conf file:

option domain-name: This option sets the domain name that will be provided to DHCP clients. For example:

option domain-name "mydomain.com";

With this setting, DHCP clients will receive the domain name "mydomain.com" as part of their network configuration.

default-lease-time and max-lease-time: These options define the default and maximum lease times for IP addresses assigned by the DHCP server. For example:

default-lease-time 600;
max-lease-time 7200;

In this example, the default lease time is set to 600 seconds (10 minutes) and the maximum lease time is set to 7200 seconds (2 hours).

subnet: This option defines a subnet and its associated network configuration parameters. For example:

subnet 192.168.1.0 netmask 255.255.255.0 {
  range 192.168.1.100 192.168.1.200;
  option routers 192.168.1.1;
  option subnet-mask 255.255.255.0;
}

In this example, a subnet with the IP range from 192.168.1.100 to 192.168.1.200 is defined. The default gateway (router) is set to 192.168.1.1, and the subnet mask is set to 255.255.255.0.

host: This option is used to define specific host configurations based on their MAC addresses. For example:

host myhost {
  hardware ethernet 00:11:22:33:44:55;
  fixed-address 192.168.1.50;
}

In this example, a host with the MAC address 00:11:22:33:44:55 is assigned the fixed IP address 192.168.1.50.

option: This option allows you to specify various additional options for DHCP clients. For example:

option domain-name-servers 8.8.8.8, 8.8.4.4;

With this setting, DHCP clients will be provided with the DNS servers 8.8.8.8 and 8.8.4.4 for name resolution.

These are just a few examples of the settings that can be specified in the /etc/dhcpd.conf file. The actual configuration options and their syntax may vary depending on the DHCP server software you are using. It's recommended to consult the documentation or man pages for your specific DHCP server implementation for accurate configuration details.

Except where otherwise noted, content on this site is licensed under a CC BY-SA 4.0 license CC BY SA