The test environment is shown in the following illustration:
Server ip:192.168.0.1
Test requirements: The Linux DHCP server is required to implement IP addresses assigned to Linux clients.
Server package: Dhcp-3.0.1-12_el. I386 (of course other versions are also available) the package defaults to the fourth type of installation CD in RHEL4.
Master profile: dhcp.conf The file is not in the DHCP software package by default and requires manual setup.
Configuration of the server:
1 mount and install the DHCP package, as shown in the following illustration:
2 Edit the configuration file (since the configuration file installation package does not automatically create the need for us to manually build) you can create a blank configuration file with just the following commands.
Vi/etc/dhcpd.conf
In order to facilitate the later explanation we empty the document to fill in the content, the specific configuration file meaning I will speak immediately.
Global settings: Usually we make the subnet 192.168.0.0 netmask 255.255.255.0 (excluding subnet this line of content) the above content becomes global. The lines have the following meanings:
Ddns-update-style Interim; : Represents the dynamic information update mode for DHCP servers and DNS servers. This line must have a DHCP server before it can be started.
Default-lease-time 21600; default lease time
Max-lease-time 43200; maximum lease time
Option Domain-name "123.com"; Name of the domain name server
Option domaini-servers 192.168.0.1 IP address of Default domain name service
Sub-network property is represented by the end of "{" to The Last "}". Its main configuration is only valid for the contents of the curly braces. A configuration file can have multiple subnet properties.
Sub 192.168.0.0 netmask 255.255.255.0; (meaning the network segment where the IP address I assigned is located
is 192.168.0.0 subnet mask is 255.255.255.0)
Range 192.168.0.2 192.168.0.100; (The Assigned IP address range is 192.168.0.2 to
192.168.0.100)
Option Subnet-mask 255.255.255.0; (The subnet mask that assigns the IP address is 255.255.255.0
Option routers 192.168.0.3; (The gateway to the client is 192.168.0.3) Master: Option router in the figure should be changed to option routers the picture is no longer changed.
Sometimes we need to configure a fixed IP address for a machine, and the following configuration options meet this requirement:
Host Server01 {
Hardware Ethernet B0:C0:12:F2:A3:A4;
Fixed-address 192.168.0.100;
}
The specific meaning and simple meaning is "we give the client MAC address configured for B0;C0;12;F2;A3;A4 IP address is 192.168.0.100".
The following legend is the start stop restart of the DHCP service. We need to start the DHCPD service when we have just finished configuring the dhcpd.conf file.
The server has configured the client how to obtain the IP address. It's actually very simple. Here I call everyone two orders, the effect is the same. Command for: Dhclint or down the interface and then up the interface is OK. This is illustrated below:
Look, we got the 192.168.0.99 IP address. Unlike Windows, Linux obtains IP addresses from a large range to a small range.
This article comes from "humbly ask" blog