当前位置:  首页>> 技术小册>> Linux应该怎么学(下)

dhcpd是Linux系统中用于提供DHCP协议的服务程序。尽管DHCP协议的功能十分强大,但是dhcpd服务程序的配置步骤却十分简单,这也在很大程度上降低了在Linux中实现动态主机管理服务的门槛。
在确认Yum软件仓库配置妥当之后,安装dhcpd服务程序:

  1. [root@linuxprobe ~]# yum install dhcp
  2. Loaded plugins: langpacks, product-id, subscription-manager
  3. This system is not registered to Red Hat Subscription Management. You can use
  4. subscription-manager to register.
  5. rhel | 4.1 kB 00:00
  6. Resolving Dependencies
  7. --> Running transaction check
  8. ---> Package dhcp.x86_64 12:4.2.5-27.el7 will be installed
  9. --> Finished Dependency Resolution
  10. Dependencies Resolved
  11. ===============================================================================
  12. Package Arch Version Repository Size
  13. ===============================================================================
  14. Installing:
  15. dhcp x86_64 12:4.2.5-27.el7 rhel 506 k
  16. Transaction Summary
  17. ===============================================================================
  18. Install 1 Package
  19. Total download size: 506 k
  20. Installed size: 1.4 M
  21. Is this ok [y/d/N]: y
  22. Downloading packages:
  23. Running transaction check
  24. Running transaction test
  25. Transaction test succeeded
  26. Running transaction
  27. Installing : 12:dhcp-4.2.5-27.el7.x86_64 1/1
  28. Verifying : 12:dhcp-4.2.5-27.el7.x86_64 1/1
  29. Installed:
  30. dhcp.x86_64 12:4.2.5-27.el7
  31. Complete!

查看dhcpd服务程序的配置文件内容。

  1. [root@linuxprobe ~]# cat /etc/dhcp/dhcpd.conf
  2. # DHCP Server Configuration file.
  3. # see /usr/share/doc/dhcp*/dhcpd.conf.example
  4. # see dhcpd.conf(5) man page

是的,您没有看错!dhcp的服务程序的配置文件中只有3行注释语句,这意味着我们需要自行编写这个文件。如果读者不知道怎么编写,可以看一下配置文件中第2行的参考示例文件

一个标准的配置文件应该包括全局配置参数、子网网段声明、地址配置选项以及地址配置参数。其中,全局配置参数用于定义dhcpd服务程序的整体运行参数;子网网段声明用于配置整个子网段的地址属性。
考虑到dhcpd服务程序配置文件的可用参数比较多,刘遄老师挑选了最常用的参数(见表14-1),并逐一进行了简单介绍,以便为接下来的实验打好基础。


该分类下的相关小册推荐: