Installing the DHCP service in Linux

Source: Internet
Author: User
Install the DHCP service in Linux-Linux Enterprise Application-Linux server application information. For details, refer to the following section. 1. Create a DHCP server configuration file

You can use Redhat Linux 9.0 to install it with its own rpm package. After the installation is complete, the DHCP port supervisor dhcpd configuration file is the dhcpd. conf file in the/etc directory. Create the/etc/dhcpd. conf file manually. /Etc/dhcpd. conf usually includes three parts: parameters, declarations, and option.

1. parameters (parameter) in the DHCP configuration file: indicates how to execute the task, whether to execute the task, or which network configuration options are sent to the customer. The main contents are shown in table 1.



Parameter description
Ddns-update-style configure DHCP-DNS interactive update mode.
Default-lease-time specifies the length of the lease time, in seconds.
Max-lease-time specifies the maximum lease time length, in seconds.
Hardware specifies the NIC interface type and MAC address.
Server-name notifies DHCP client server name.
Get-lease-hostnames flag checks the IP address used by the client.
The fixed-address ip address is assigned to the client as a fixed address.
Authritative rejects incorrect IP address requirements.

2. declarations (Declaration) in the DHCP configuration file: used to describe the network layout and provide the customer's IP address. The main content is shown in table 2:

Statement explanation
Shared-network is used to tell if some sub-networks share the same network.
Subnet describes whether an IP address belongs to this subnet.
Range: The range in which IP addresses are terminated.
For host names, refer to special hosts.
Group provides a declaration for a group of parameters.
Allow unknown-clients? Whether the deny unknown-client dynamically allocates IP addresses to unknown users.
Allow bootp; whether deny bootp responds to the activation query.
Allow booting? Whether deny booting responds to user queries.

2005520124131. The name of the htm start file, which is applied to the diskless workstation.
Next-server: Set the Host Name of the server from the boot file and apply it to the diskless workstation.



3. option in the DHCP configuration file: used to configure optional DHCP parameters. All parameters start with the option keyword. The main content includes table 3:



Option description
Subnet-mask Sets the subnet mask for the client.
Domain-name indicates the DNS name of the client.
Domain-name-servers specifies the IP address of the DNS server for the client.
Host-name specifies the host name of the client.
Routers sets the default gateway for the client.
Broadcast-address: Set the broadcast address for the client.
Ntp-server sets the IP address of the server for the client network time.
Time-offset is the offset time set by the client and Greenwich Mean time, in seconds.



Note: If the client uses a Windows operating system, do not select the "host-name" option, that is, do not specify the host name for it.

The following is a DHCP configuration file used by the author. This is a class C network. A total of 126 IP addresses can be allocated. The reader can copy and use it. Note that the red part must be modified.



Ddns-update-style interim;
Ignore client-updates;

Subnet 192.168.1.0 netmask 255.255.255.0 {

Option routers 192.168.1.254;
Option subnet-mask limit 255.0;
Option broadcast-address 192.168.1.255;
Option domain-name-servers 192.168.1.3;
Option domain-name "www.cao.com"; # DNS name #
Option domain-name-servers 192.168.1.3;

Option time-offset-18000;

Range dynamic-bootp 192.168.1.128 192.168.1.255;
Default-lease-time 21600;
Max-lease-time 43200;

Host ns {
Hardware ethernet 52: 54: AB: 34: 5B: 09; # MAC address of the network interface running DHCP #
Fixed-address 192.168.1.9;
}
}


Ii. Create a customer Lease document

To run the DHCP server, you also need a file named dhcpd. leases to keep all the IP addresses that have been distributed. In the Redhat Linux release version, the file is located in the/var/lib/dhcp/directory. If you install isc dhcp through RPM, the directory already exists. The file format of dhcpd. leases is:


Leases address {statement}




The content of a typical file is as follows:


Lease 192.168.1.255 {# IP address allocated by the DHCP server #
Starts 1 03:02:26; # lease start lease time #
Ends 1 09:02:26; # lease end lease time #
Binding state active;
Next binding state free;
Hardware ethernet 00: 00: e8: a0: 25: 86; # client Nic MAC address #
Uid "010000350240% 206"; # used to verify the uid id of the Client #
Client-hostname "cjh1"; # client name #
}




Note that the lease start lease time and lease end lease time are Greenwich Mean Time (GMT), not local time.

When the DHCP server is run for the first time, dhcpd. leases is an empty file and does not need to be created manually. If isc dhcp is not installed through RPM, or dhcpd has been installed, you should try to determine where the dhcpd writes its lease file and ensure that the file exists. You can also create an empty file manually:
(
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.