Notes on setting up a DHCP server in wdOS

Source: Internet
Author: User

WdOS is a simplified and optimized Linux Server System Based on CentOS. Most of them retain centos services. DHCP (Dynamic Host Configuration Protocol) is one of them. By configuring the DHCP server, you can dynamically allocate IP addresses, subnet masks, gateways, and DNS server addresses to the DHCP client.
  
DHCP works in four phases: IP leasing requests, IP leasing, IP leasing selection, and IP leasing confirmation.
1. IP address lease request: if the customer's computer is set to automatically obtain the IP address at any time, it will check whether it has rented an IP address when it starts up. If not, it requests a lease from DCHP. Because the client computer does not know the address of the DHCP server, 255.255.255.255 is used as the destination address, and 0.0.0.0 is used as the source address to broadcast a DHCPDISCOVER message on the network, the message contains the Media Access Control (MAC) address of the client computer (the hardware address built in the NIC) and its NetBIOS name.
2. IP Leasing: When the DHCP server receives an IP leasing request from a customer, it will reserve an IP address for the customer based on its own scope address pool and broadcast one on the network, the message contains the customer's MAC address, the IP address that the server can provide, the subnet mask, the lease term, and the IP address of the rented DHCP server.
3. IP Leasing: if another DHCP server exists in the subnet, after the client receives the DHCPOFFER message from a DHCP server, it broadcasts a DHCPREQUEST message containing the IP address of the server that provides the lease. In this subnet, it notifies all other DHCP servers that it has accepted the provision of an IP address, after receiving this message, other DHCP servers will unlease the client. Then, return the lease address assigned to the customer to the address pool. The address can be used as a valid address for other computers.
IP lease confirmation: When the DHCP server receives a DHCPREQUEST message from the customer, it starts the last phase of the configuration process. The DHCP server sends a DHCPACK packet to the customer, this package includes a lease term and all other configuration information requested by the customer. So far, the TCP/IP configuration has been completed.

This article attempts to build a DHCP server in wdOS. The specific configuration process is as follows:
  
Ii. configuration process:
1. Before the configuration starts:
1. Disable the DHCP service of vmware first:
1) In the vmware program menu, select Edit-Virtual Network Editor
2) do not select the use local dhcp service to distribute ip address to vms option.

Check whether the IP address, subnet mask, gateway, and dns server address of the DHCP server are configured:
You can use ifconfig to check whether the IP address is set during installation. Note that the network configuration of your dhcp server should be manually configured.

3. Configure the Linux DHCP server
Install the DHCP main program:
Check whether the dhcp master package is installed before installation:

Only the dhcp Client package is installed. Therefore, you can use yum install dhcp to install the dhcp MAIN package:

Modify the main configuration file/etc/dhcpd. conf
Note: When the DHCP master package is installed, the template file/usr/share/doc/dhcp-3.0.5/dhcpd of the master configuration file is automatically generated. conf. sample, and a blank dhcpd will be created under the/etc directory. conf main configuration file, copy the template configuration file to the dhcpd under the/etc directory. in the conf main configuration file:



4. Restart the dhcpd service:



Test results:
Use dhclient eth0 to enable the network adapter eth0 as the dhcp client.

You can also run the ifconfig command to view the obtained IP Address:

P.s. careful readers may find that the obtained IP address is exactly the largest IP address in the dhcp server address pool I originally set, this is the opposite of the IP address obtained by the dhcp service in windows.

Possible problems:
1. You can disable the firewall before testing. You can use the command: service iptables stop to disable the firewall.
2. If an error occurs during the test: (dhclient already exists)

Run the command: kill-9 + The prompted process number (3443 is displayed here) to close the process and obtain it again.
 
This tutorial is taken from the wdlinux Forum http://www.wdlinux.cn/bbs/. For more information, see!
 

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.