Build a DHCP server In Debian Linux

Source: Internet
Author: User
Article Title: Build a DHCP server In Debian Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

In a common small network, network administrators usually assign IP addresses manually. However, in large and medium-sized networks, this method is not suitable. In large and medium-sized networks, especially large networks, there are usually more than 100 clients. It is difficult to manually assign IP addresses. Therefore, we must introduce an efficient IP Address Allocation Method. Fortunately, DHCP solves this problem for us.

Dynamic Host Configuration Protocol (DHCP) is a TCP/IP standard that simplifies Host IP configuration management. The DHCP standard provides an effective method for DHCP servers: Managing Dynamic IP Address Allocation and other configuration information related to enabling DHCP clients on the network.

Each computer on a TCP/IP network must have a unique IP address. The IP address (and the associated subnet mask) identifies the master computer and its connected subnet. When you move a computer to a different subnet, you must change the IP address. DHCP allows you to dynamically assign an IP address to the client from the IP address database of the DHCP server on the local network.

DHCP avoids configuration errors caused by manually entering values on each computer. DHCP also helps prevent address conflicts caused by reusing previously assigned IP addresses when a new computer is configured on the network.

Using a DHCP server can greatly reduce the time used to configure and reconfigure the online computer. You can configure the server to provide the full range of other configuration values when you assign an address lease. These values are assigned using the DHCP option.

In addition, the DHCP lease renewal process also helps ensure that client configurations need to be updated frequently (for example, users who frequently change their locations using mobile or portable computers ), the client can communicate directly with the DHCP server to make these changes efficiently and automatically.

3. Workflow

1. Discovery stage.

The DHCP Client sends DHCPdiscover discovery information to the DHCP server in broadcast mode (because the IP address of the DHCP server is unknown to the client), that is, it sends specific broadcast information to the IP address 255.255.255.255. Each host installed with the TCP/IP protocol on the network will receive this broadcast information, but only the DHCP server will respond.

2. Provision phase.

The DHCP server that receives DHCPdiscover discovery information in the network will respond, and it selects an IP address allocated to the DHCP client from the IP address that has not been rented, send a DHCPoffer containing the rented IP address and other settings to the DHCP client.

3. Select a stage.

If Multiple DHCP servers provide information to the DHCPoffer sent by the DHCP client, the DHCP client only accepts the information provided by the first DHCPoffer received, and then replies to a DHCPrequest message in broadcast mode, this information contains the IP Address requested from the selected DHCP server. The answer is broadcast to notify all DHCP servers that they will select the IP address provided by a DHCP server.

4. validation phase.

After receiving the DHCPrequest request from the DHCP client, the DHCP server sends a confirmation message containing the IP address provided by the DHCP Client and other settings to the DHCP client, the IP address provided by the DHCP client. Then, the DHCP client binds the TCP/IP protocol to the NIC. In addition, all the DHCP servers except the selected server of the DHCP client will reclaim the IP address.

5. log on again.

In the future, each time the DHCP Client re-logs on to the network, it does not need to send the DHCPdiscover discovery information, but directly sends the DHCPrequest request information containing the previous IP address. When the DHCP server receives this information, it will attempt to allow the DHCP client to continue using the original IP address and answer a DHCPack confirmation message. If the IP address cannot be assigned to the original DHCP Client for use (for example, the IP address has been assigned to another DHCP client), the DHCP server returns a DHCPnack denial message to the DHCP client. When the original DHCP client receives the DHCPnack denied information, it must resend the DHCPdiscover information to request a new IP address.

6. Update the lease.

The IP address rented by the DHCP server to the DHCP Client generally has a lease term. After the lease term expires, the DHCP server will reclaim the IP address. If the DHCP Client wants to extend its IP lease, it must update its IP lease. When a DHCP Client is started and half of the IP Lease Term expires, the DHCP Client automatically sends an update message to the DHCP server.

DHCP Server Installation Configuration

4.1 Installation

~ # Aptitude install dhcp3-server dhcp3-common

Current version 3.0.4-6

The/etc/default/dhcp3-server is automatically created during installation

4.2 configuration file:

/Etc/dhcp3/dhcpd. conf

/Etc/init. d/dhcp3-server

Http://www.isc.org/sw/dhcp/

/Etc/dhcp3/dhcpd. conf usually includes three parts: parameters, declarations, and option.

Parameters (parameter): indicates how to execute the task, whether to execute the task, or which network configuration options are sent to the customer.

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.

Declarations: used to describe the network layout and provide the customer's IP address:

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.

[1] [2] Next page

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.