Setting Up the Server's Network Interfaces
By default, the dhcpd
service processes requests on those network interfaces
that connect them to subnets that are defined in the DHCP configuration file.
Suppose that a DHCP server has mutliple interfaces. Through its interface
enp0s1
, the server is connected to the same subnet as the clients that the
server is configured to serve. In this case, enp0s1
must be set in the DHCP
service to enable the server to monitor and process incoming requests on that interface.
Before proceeding to either of the following procedures, ensure that you meet the following requirements:
- You have the proper administrative privileges to configure DHCP.
- You have installed the
dhcp-server
package.If not, install the package with the following command:
sudo dnf install dhcp-server
Configure the network interfaces as follows:
- For IPv4 networks:
- Copy the
/usr/lib/systemd/system/dhcpd.service
file to the/etc/systemd/system/
directory.sudo cp /usr/lib/systemd/system/dhcpd.service /etc/systemd/system/
- Edit the
/etc/systemd/system/dhcpd.service
by locating the line that defines theExecStart
parameter. -
Append the interface names on which the
dhcpd
service should listen.See the sample entries in bold.
ExecStart=/usr/sbin/dhcpd -f -cf /etc/dhcp/dhcpd.conf -user dhcpd -group dhcpd --no-pid $DHCPDARGS int1-name int2-name
- Reload the
systemd
manager configuration.sudo systemctl daemon-reload
- Restart the
dhcpd
service configuration.sudo systemctl restart dhcpd.service
Alternatively, you can also type:
sudo systemctl restart dhcpd
- Copy the
- For IPv6 networks:
- Copy the
/usr/lib/systemd/system/dhcpd6.service
file to the/etc/systemd/system/
directory.sudo cp /usr/lib/systemd/system/dhcpd6.service /etc/systemd/system/
- Edit the
/etc/systemd/system/dhcpd6.service
file by locating the line that defines theExecStart
parameter. -
Append the names of the interfaces on which the
dhcpd6
service should listen.See the sample entries in bold.
ExecStart=/usr/sbin/dhcpd -f -cf /etc/dhcp/dhcpd6.conf -user dhcpd -group dhcpd --no-pid $DHCPDARGS int1-name int2-name
- Reload the
systemd
manager configuration.sudo systemctl daemon-reload
- Restart the
dhcpd
service configuration.sudo systemctl restart dhcpd6.service
Alternatively, you can also type:
sudo systemctl restart dhcpd6
- Copy the