Installing a DHCP server
DHCP configuration file
You can install the RPM package that is carried with Rhel 6.0 itself, and the DHCP port watchdog program DHCPD configuration file is the file named dhcpd.conf in the/ETC/DHCP directory after the installation is complete. The following manual builds the/etc/dhcp/dhcpd.conf file, which typically consists of 3 sections, the parameters parameter, declarations declaration, and option option.
1. Parameters (parameters) in the DHCP configuration file
Parameters shows how to perform a task, and whether to perform a task or send the network configuration options to the customer
|
Key parameters in the DHCP configuration file |
|
Parameters |
Explain |
|
Ddns-update-style |
Configuring DHCP-DNS Interactive Update mode |
|
Default-lease-time |
Specify the length of the default lease time, in seconds |
|
Max-lease-time |
Specify the maximum lease duration in seconds |
|
Hardware |
Specify the NIC interface type and MAC address |
|
Server-name |
Notifies the DHCP client server of the name |
|
Get-lease-hostnames Flag |
Check the IP address used by the client |
|
Fixed-address IP |
Assign a fixed address to the client |
|
Authoritative |
Request to reject an incorrect IP address |
2. declarations (Declaration) in the DHCP configuration file
Declarations is used to describe the network layout and provide the customer's IP address.
|
Main statement |
|
Statement |
Explain |
|
Shared-network |
Used to tell if some sub-networks share the same network |
|
Subnet |
Describes whether an IP address belongs to this subnet |
|
Range Start IP termination IP |
Provides a range of dynamically assigned IPs |
|
Host Name |
Refer to Special hosts |
|
Group |
Provide a declaration for a set of parameters |
|
Allow Unknown-clients;deny unknown-client |
Whether to assign IP dynamically to unknown users |
|
Allow Bootp;deny BOOTP |
Whether to respond to activation queries |
|
Allow Booting;deny booting |
Whether to respond to consumer queries |
|
FileName |
Name of the start file to be used for diskless workstations |
|
Next-server |
Set server to mount host name from boot file to diskless workstation |
Option (options) in the 3.DHCP configuration file
option is used to configure DHCP optional parameters, all with the option keyword as the starting point.
|
Main options |
|
Options |
Explain |
|
Subnet-mask |
To set the subnet mask for the client |
|
Domain-name |
Specifying DNS names for clients |
|
Domain-name-servers |
Specify the IP address of the DNS server for the client |
|
Host-name |
Specify the host name for the client |
|
Routers |
Setting a default gateway for clients |
|
Broadcast-address |
Set the broadcast address for the client |
|
Ntp-server |
Set the IP address of the network time server for the client |
|
Time-offset |
Set the offset time of GMT for the client in seconds |
|
Nis-server |
Setting NIS domain names for clients |
4. Configuring Instances
Radhad RHEL 6.2 DHCP Server installation Process
Assign IP address to this server before installing DHCP service: 192.168.X.1/24, Gateway: 192.168.x.254,dns Address: 192.168.x.1
1) , loading the optical drive
First insert the Redhat installation disc, mount the optical drive
First create a new directory under/mnt Rhel:
#mkdir/mnt/rhel
Next, mount the optical drive to Rhel
# mount–t Iso9660/dev/sr1/mnt/rhel(Note: SR1 is the second optical drive, so mount the Linux ISO file in the second optical drive before mounting)
Mount:block Device/dev/cdrom is write-protected, mounting read-only
Loaded successfully!
2) , Installing the DHCPD service software
# rpm-ivh/mnt/rhel/packages/dhcp-4.1.1-47.p1.el6.i686.rpm
Warning:/media/packages/dhcp-4.1.1-25.p1.el6.i686.rpm:header V3 rsa/sha256 Signature, key ID Fd431d51:nokey
Preparing ... ########################################### [100%]
1:dhcp ########################################### [100%]
Tip 100% indicates that the installation was successful.
3) Configuration of the DHCP service
Dhcpd.conf is the configuration file of the DHCP service, all parameters of the DHCP service are implemented by modifying the dhcpd.conf file, and after installation dhcpd.conf is not configured, dhcpd.conf files are in the/etc/dhcp/directory.
We can use the #cat dhcpd.conf command to view the contents of the file:
#
# DHCP Server Configuration file.
# See/usr/share/doc/dhcp*/dhcpd.conf.sample
# See ' Mans 5 dhcpd.conf '
The meaning here is that this file is a DHCP server configuration file, which is configured to refer to Dhcpd.conf.sample.
Next we'll copy the/usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample to the dhcpd.conf file for configuration:
# cp/usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample/etc/dhcp/dhcpd.conf
CP: Do you want to overwrite "dhcpd.conf"? Y
Copy well, through the VI command to modify the contents of the dhcpd.conf file:
#vi/etc/dhcp/dhcpd.conf Modify the inside of a subnet subnet, that is, create a scope:
Subnet 192.168.x.0 netmask 255.255.255.0 {
Range 192.168.x.100 192.168.x.200;
Option Domain-name-servers 192.168.55.1;
Option Domain-name "www.abc.com";
option routers 192.168.x.254;
}
The above instance configuration file is divided into two sections, that is, subnet configuration information and global configuration information. There can be multiple subnets, here for simplicity, only one subnet is specified.
Subnet.
In the example above, a subnet declaration begins with the "subset" keyword, so the subnet information is included in the {}. The configuration information in {} is valid only for that subnet and overrides the global configuration.
2. Start the DHCP server
To start a DHCP server with a command:
#service DHCPD Start
Restart the DHCPD service automatically after setting the server restart
#chkconfig DHCPD on
3. The Client XP test is able to automatically obtain the IP address from the DHCP server address pool correctly.
Go to the XP system CMD console and see if you can get the IP address correctly by command ipconfig/release (release IP), ipconfig/renew (regain IP), Ipconfig/all.
LINUX_RHEL6_DHCP Server Configuration