Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

14.2 Deploy the dhcpd service program


May 24, 2021 That's what Linux should learn



Dhcpd is a service program used in Linux systems to provide DHCP protocols. Although the DHCP protocol is powerful, the configuration steps for the dhcpd service program are simple, which greatly lowers the threshold for implementing dynamic host management services in Linux.

After confirming that the Yum software repository is configured, install the dhcpd service program:

[root@linuxprobe ~]# yum install dhcp Loaded plugins: langpacks, product-id, subscription-manager This system is not registered to Red Hat Subscription Management. Y ou can use subscription-manager to register. r hel | 4.1 kB 00:00 Resolving Dependencies --> Running transaction check ---> Package dhcp.x86_64 12:4.2.5-27.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved

  1. Package Arch Version Repository Size
  2. ================================================================================
  3. Installing:
  4. dhcp x86_64 12:4.2.5-27.el7 rhel 506 k
  5. Transaction Summary
  6. ================================================================================
  7. Install 1 Package
  8. Total download size: 506 k
  9. Installed size: 1.4 M
  10. Is this ok [y/d/N]: y
  11. Downloading packages:
  12. Running transaction check
  13. Running transaction test
  14. Transaction test succeeded
  15. Running transaction
  16. Installing : 12:dhcp-4.2.5-27.el7.x86_64 1/1
  17. Verifying : 12:dhcp-4.2.5-27.el7.x86_64 1/1
  18. Installed:
  19. dhcp.x86_64 12:4.2.5-27.el7
  20. Complete!
  21. 查看dhcpd服务程序的配置文件内容。

[root@linuxprobe ~]# cat /etc/dhcp/dhcpd.conf

DHCP Server Configuration file.

  1. # see /usr/share/doc/dhcp*/dhcpd.conf.example
  2. # see dhcpd.conf(5) man page

Yes, you're not mistaken! T here are only three lines of comment statements in the configuration file of the dhcp service program, which means that we need to write this file ourselves. If the reader doesn't know how to write it, take a look at the reference sample file for line 2 in the configuration file, which consists of a schema shown in Figure 14-2.

14.2 Deploy the dhcpd service program

Figure 14-2 the schema of the dhcpd service provider profile

A standard profile should include global configuration parameters, subnet segment declarations, address configuration options, and address configuration parameters. Where the global configuration parameters are used to define the overall operating parameters of the dhcpd service program, the subnet segment declaration is used to configure the address properties of the entire subnet segment.

Considering that there are many parameters available for the dhcpd service program profile, Mr. Liu selected the most commonly used parameters (see Table 14-1) and introduced them briefly one by one to provide a good basis for the next experiment.

Table 14-1 the common parameters used in the dhcpd service program configuration file and their effects

Parameter Act ddns-update-style type Defines the type of dynamic update for DNS services, including: none (no dynamic updates supported), interim (interactive update mode) and ad-hoc (special update mode) allow/ignore client-updates allow/ignore clients to update DNS records default-lease-time 21600 default timeout max-lease-time 43200 maximum time-out option-name-servers 8.8.8.8.8 define DNS server address domain-domain.org define DNS domain name range defines the client's subnet-mask for the assigned IP address pool option subnet-mask defines the client's subnet mask option routers define the client's gateway address B roadcast-address broadcast address Define the client's broadcast address ntp-server IP address Define the client's network time server (NTP) nis-servers IP address Define the client's NIS domain server address hardware hardware type MAC address Specify the type of network card interface and MAC address server-name host name to the DHCP client to notify the DHCP server's host name fixed-address IP address to assign a fixed IP address to the specified host time-offset offset. Ask bold questions!

Because readers have different hardware or operation errors may lead to experimental configuration errors, please be patient and take a closer look at the operation steps, do not be discouraged

Linux technical exchange please add Group A: 560843 (full), Group B: 340829 (recommended), Group C: 463590 (recommended), click here to view the national group.

This group features: through password verification to ensure that each group member is "Linux should learn" readers, more targeted, from time to time free to receive customized gifts.