dhcpd是Linux系统中用于提供DHCP协议的服务程序。尽管DHCP协议的功能十分强大,但是dhcpd服务程序的配置步骤却十分简单,这也在很大程度上降低了在Linux中实现动态主机管理服务的门槛。
在确认Yum软件仓库配置妥当之后,安装dhcpd服务程序:
[root@linuxprobe ~]# yum install dhcp
Loaded plugins: langpacks, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use
subscription-manager to register.
rhel | 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
===============================================================================
Package Arch Version Repository Size
===============================================================================
Installing:
dhcp x86_64 12:4.2.5-27.el7 rhel 506 k
Transaction Summary
===============================================================================
Install 1 Package
Total download size: 506 k
Installed size: 1.4 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : 12:dhcp-4.2.5-27.el7.x86_64 1/1
Verifying : 12:dhcp-4.2.5-27.el7.x86_64 1/1
Installed:
dhcp.x86_64 12:4.2.5-27.el7
Complete!
查看dhcpd服务程序的配置文件内容。
[root@linuxprobe ~]# cat /etc/dhcp/dhcpd.conf
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.example
# see dhcpd.conf(5) man page
是的,您没有看错!dhcp的服务程序的配置文件中只有3行注释语句,这意味着我们需要自行编写这个文件。如果读者不知道怎么编写,可以看一下配置文件中第2行的参考示例文件
一个标准的配置文件应该包括全局配置参数、子网网段声明、地址配置选项以及地址配置参数。其中,全局配置参数用于定义dhcpd服务程序的整体运行参数;子网网段声明用于配置整个子网段的地址属性。
考虑到dhcpd服务程序配置文件的可用参数比较多,刘遄老师挑选了最常用的参数(见表14-1),并逐一进行了简单介绍,以便为接下来的实验打好基础。