Configuring the DHCP server is what we will explain for you now. Here we will analyze the specific process. Including installation, parameter configuration, and other details. So let's take a look at the specific content.
1. DHCP server startup script --/etc/rc. d/init. d/dhcpd
This script can be used to start, query, and stop DHCP servers. Configure the DHCP server before starting the instance.
2. Configure the DHCP server
(1) DHCP configuration file --/etc/dhcpd. conf
RHEL5 is a blank file by default after installation.
The file template is:/usr/share/doc/dhcp-3.0.5/dhcpd. conf. sample
Cp/usr/share/doc/dhcp-3.0.5/dhcpd. conf. sample/etc/dhcpd. conf
Shows cat/etc/dhcpd. conf.
Ddns-update-style interim; // It is required to define the supported DNS dynamic update types. It is generally set to disabled, interim and none both mean interim, ad-hoc, or none)
Ignore client-updates; // configure the DHCP server to ignore client updates and do not allow dynamic dns updates
Subnet 172.16.210.0 netmask 255.255.255.0 {// declare a network segment
# --- Default gateway
Option routers 172.16.210.254; // The gateway address or Route IP address assigned to the client
Option subnet-mask subnet mask 255.255.0; // The subnet mask allocated to the client
Option nis-domain "domain.org"; // sets the NIS domain name
Option domain-name "domain.org"; // set the DNS domain name, which must be consistent with the DNS domain name
Option domain-name-servers 172.16.210.1; // ip address of the DNS server
Option time-offset-18000; // set the offset time for the client and Greenwich Mean time.
# Option ntp-servers 172.16.210.1; // set the Server IP address for the client's Network Time
# Option netbios-name-servers 172.16.210.1; // configure the DHCP server and set the default WINS Server
# --- Selects point-to-point node (default is hybrid). Don't change this nless
# -- You understand Netbios very well
# Option netbios-node-type 2;
Range dynamic-bootp 172.16.210.210 172.16.210.240; // IP address range that can be allocated
Default-lease-time 21600; // The default lease time is 6 hours.
Max-lease-time 43200; // The maximum lease time is 12 hours.
# We want the nameserver to appear at a fixed address
Host ns {// host Declaration on the host whose host name is ns to set IP Address Allocation for the specific Nic
Next-server marvin.redhat.com; # sets the host name that is loaded from the boot file on the server for diskless websites.
Hardware ethernet 12: 34: 56: 78: AB: CD; // MAC address of the host
Fixed-address 172.16.210.222; // The address is always assigned to the host.
}
}
# Configure the DHCP server and global configuration items
# Use subnet to define the DHCP scope. A network segment should define a scope.
Shared-network test {
Subnet 1 netmask subnet mask {
Option routers default gateway address;
Range [dynamic-bootp] low-address [high-address]; # specify the IP address pool range that can be allocated.
[Other optional settings]
}
......
Subnet n netmask subnet mask {
Option routers default gateway address;
Range [dynamic-bootp] low-address [high-address];
[Other optional settings]
}
}
Group {# Set Group configuration items
Host name 1 {
Physical address of the hardware ethernet NIC;
Settings for the host;
}
}
3. Configure the DHCP server to start the DHCP server.
Start
# Service dhcpd start
Restart
Service dhcpd restart
Query the service startup status
Service dhcpd status
Stop Service
Service dhcpd stop
4. Test the DHCP server
Start DHCP Service
Set the IP address on the physical machine to automatically obtain
Open "run" → enter "cmd"
Release IP Address: ipconfig/release
Apply for IP address again: ipconfig/renew
Run: ipconfig/all
If the assigned IP address, default gateway, and DNS server address are displayed, the DHCP server works properly and is successfully configured.