15.Linux安装DHCP服务为虚拟机分配IP

时间:2023-12-26 12:57:43

$ rpm -ql dhcp        #检查是否安装dhcp

$ yum -y install dhcp*    #安装dhcp
$ cd /etc/dhcp        #配置文件位置
$ vim /etc/dhcp/dhcpd.conf
  1. #
  2. # DHCP Server Configuration file.
  3. # see /usr/share/doc/dhcp*/dhcpd.conf.sample
  4. # see 'man 5 dhcpd.conf'
  5. #
  6. ddns-update-style interim;
  7. ignore client-updates;
  8. filename "pxelinux.0";
  9. next-server 192.168.10.10;
  10. subnet 192.168.0.0 netmask 255.255.255.0{
  11. option routers 192.168.10.1;
  12. option subnet-mask 255.255.255.0;
  13. range dynamic-bootp 192.168.10.2192.168.10.254;
  14. default-lease-time 21600;
  15. max-lease-time 43200;
  16. }