1. DHCP Installation and configuration
Yum Install DHCP
Cp/usr/share/doc/dhcp*/dhcpd.conf.sample/etc/dhcp/dhcpd.conf
Vim/etc/dhcp/dhcpd.conf
Option Domain-name "redhat.com";
Option Domain-name-servers 202.96.128.166, 114.114.114.114; # Set up DNS
Default-lease-time 3600; # Default lease time, per second
Max-lease-time 7200; # Maximum lease time, per second
Log-facility Local7; # Log Level
Subnet 192.168.101.0 netmask 255.255.255.0 {
Range 192.168.101.150 192.168.101.180; # IP address ranges that can be obtained by DHCP
Option routers 192.168.101.254; # Gateway
Option Subnet-mask 255.255.255.0; # Subnet Mask
Host Test {
Hardware Ethernet 00:0c:29:6f:38:e4; # The MAC address of the bound host
Fixed-address 192.168.101.208; # bound IP
}
}
2. Start the DHCP service
Service DHCPD Restart
3. View DHCP client status
Cat/var/lib/dhcpd/dhcpd.leases
cat/var/lib/dhcpd/dhcpd.leases~
Dhclient: Get Address
-D: Run in foreground and display the get process
-R: Release address
Linux DHCP server Simple configuration Example