Detailed configuration of Dhcp servers in CentOS
1. Install dhcp
Yum install dhcp. x86_64
Ii. Modify the dhcp master configuration file
Vim/etc/dhcp/dhcpd. conf
Dns-update-style interim; # indicates the dynamic information update mode of the dhcp server and dns server. This line must have a dhcp server before it can be started.
Ignore client-updates; # ignore client updates
Subnet 192.168.1.0 netmask 255.255.255.0 {# indicates that the IP address I allocated is in the CIDR block of 192.168.1.0 and the subnet mask of 255.255.255.0.
Option routers 192.168.1.1; # The Gateway assigned to the client is 192.168.1.1
Option nis-domain ning.com; # assign the nis domain to the client
Option domain-name ning.com; # domain name for the client
Option subnet-mask subnet mask 255.255.0; # assign the subnet mask of the IP address
Option ntp-servers 192.168.1.22; # Send it to the ntp server of the Client
Option netbios-name-servers 192.168.1.22; # server address
Option domain-name-servers 192.168.1.21; # default domain name Service IP Address
Option time-offset-18000; # time offset
Range dynamic-bootp 192.168.1.50 192.168.1.254; # assigned IP address range
Default-lease-time 21600; # default lease time
Max-lease-time 43200; # maximum lease time
Sometimes we need to configure a fixed IP address for a machine, and the following configuration options meet this requirement:
Host ning {
Hardware ethernet 52: 54: 00: fa: bb: 29;
Fixed-address 192.168.1.66;
}
}
Client: dhclint or ifdown eth0; ifup eth0;