To configure the DHCP server using DHCP in RHEL5.4, follow these steps:
1. Install DHCP server software
Check whether dhcp is installed
Rpm-q dhcp
Mount/dev/cdrom/media
Rpm-ivh/media/Server/dhcp-3.0.5-21.el5.i386.rpm
2. Modify the DHCP master configuration file
The main configuration file is/etc/dhcpd. conf.
Configuration parameters can be generated through the DHCP template configuration file
Cat/usr/share/doc/dhcp-3.0.5/dhcpd. conf. sample>/etc/dhcpd. conf
3. modify the configuration file dhcpd. conf.
Ddns-update-style interim;
Ignore client-updates;
Subnet 192.168.100.0 netmask 255.255.255.0 {
Option routers 192.168.100.1;
Option subnet-mask limit 255.0;
Range dynamic-bootp 192.168.100.100 192.168.100.200;
Default-lease-time 21600;
Max-lease-time 43200;
}
4. Start the DHCPd Service
Service dhcpd start
Check whether the service port is on: netstat-anpu | grep dhcpd
5. Configure the DHCP Client
-- Windows client Configuration
-- Linux client configuration, you can use the dhclient command
6. view the lease file on the DHCP server
Cat/var/lib/dhcpd. leases
############################ Split line, basic DHCP configuration complete #########################
7. Configure the DHCP server to retain the host
Modify the main configuration file:
Ddns-update-style interim;
Ignore client-updates;
Subnet 192.168.100.0 netmask 255.255.255.0 {
Option routers 192.168.100.1;
Option subnet-mask limit 255.0;
Range dynamic-bootp 192.168.100.100 192.168.100.200;
Default-lease-time 21600;
Max-lease-time 43200;
Host linux01 {
Hardware ethernet 00: 0c: 29: fc: 68: 14;
Fixed-address 192.168.100.188;
}
}
The host declaration is used here for configuration!
8. Release the IP address on the client and obtain it again.
-- Windows client Configuration
Ipconfig/release
Ipconfig/renew
-- Linux client Configuration
Ifdown eth0
Ifup eth0
############################ Split line, DHCP retained host configuration complete #########################
9. Configure multiple DHCP scopes
Ddns-update-style interim;
Ignore client-updates;
Subnet 192.168.100.0 netmask 255.255.255.0 {
Option routers 192.168.100.1;
Option subnet-mask limit 255.0;
Default-lease-time 21600;
Max-lease-time 43200;
Host linux01 {
Hardware ethernet 00: 0c: 29: fc: 68: 14;
Fixed-address 192.168.100.188;
}
}
Subnet 172.16.1.0 netmask 255.255.255.0 {
Option routers 172.16.1.2;
Range dynamic-bootp 172.16.1.100 172.16.1.200;
Default-lease-time 21600;
Max-lease-time 43200;
}
If there are other scopes, use the subnet Declaration to create them! The method is similar!
10. DHCP relay proxy configuration is required for implementation and testing of Multiple DHCP scopes
(Network environment required to complete the DHCP relay proxy experiment)
11. Assume that the IP address of the DHCP relay proxy server is 172.16.1.2.
12. Enable route forwarding
There are two ways to enable the linux kernel route forwarding function
# Method 1:
Vi/etc/sysctl. conf
Net. ipv4.ip _ forward = 1
Run the sysctl-p command.
# Method 2:
Echo 1>/proc/sys/net/ipv4/ip_forward
(Either of the two methods can be implemented)
13. Install the dhcp software package on the relay proxy server because the software program for configuring the DHCP relay proxy is in this package.
(Install DHCP Software Package omitted)
14. DHCP relay related programs and configuration files
/Etc/rc. d/init. d/dhcrelay DHCP relay start script
/Etc/sysconfig/dhcrelay DHCP relay configuration file
/Usr/sbin/dhcrelay DHCP relay Application
15. Configure DHCP relay (two methods are available)
# Method 1:
Vi/etc/sysconfig/dhcrelay
INTERFACES = "eth0 eth1"
DHCPSERVERS = "192.168.100.1"
# Method 2:
Dhcrelay-I eth0 192.168.100.1
16. Start the dhcrelay Relay Service
Service dhcrelay start
Set dhcrelay to automatically start the relay service at runtime level 35
Chkconfig -- level 35 dhcrelay on
17. Test the function of obtaining an IP address on the client!