DHCP

实验前准备:

客户端:

dhcp 68端口

服务器:

dhcp67端口

将网络已有的DHCP服务(vmware的DHCP关闭),防止冲突

服务器:

 vim /etc/dhcp/dhcpd.conf
  
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp-server/dhcpd.conf.example
# see dhcpd.conf(5) man page
option domain-name-servers 180.76.76.76,223.5.5.5,10.0.0.2; #DNS服务器

default-lease-time 86400;               #默认租赁时间
max-lease-time 172800;                  #最大租赁时间

subnet 10.0.0.0 netmask 255.255.255.0 {
  range 10.0.0.10 10.0.0.100;      #可分配网段
  range 10.0.0.130 10.0.0.200;
  option routers 10.0.0.2;         #网关
  next-server 10.0.0.138;          #tftp服务器地址,即下载bootloader的IP地址
  filename "pxelinux.0";           #bootloader启动文件名
}


systemctl enable --now dhcp

DHCP服务器给指定主机分配固定IP

[root@centos8 ~]#vim /etc/dhcp/dhcpd.conf
subnet 10.0.0.0 netmask 255.255.255.0 {
	range 10.0.0.50 10.0.0.100;  
    range 10.0.0.150 10.0.0.200;  
    option routers 10.0.0.2;   
    next-server 10.0.0.8;  
    filename "pxelinux.0";
}

host test { 
  hardware ethernet 00:0c:29:cd:90:10; 
  fixed-address 10.0.0.115;
  default-lease-time 86400; 		#默认租赁时间
  max-lease-time 172800; 			#最大租赁时间
}
上一篇:44_Go基础_1_11 switch


下一篇:(自我整理)学习java第三天