DHCP server-Zero-configuration Access Network

Source: Internet
Author: User

Directory:
Introduction
Profile
Application Cases
DHCP is short for Dynamic Host Configuration Protocol (Dynamic Host Configuration Protocol). DHCP can be used to automatically allocate TCP/IP information to client hosts, such as IP addresses, subnet masks, gateways, and DNS, the server can assign specific parameter information to a specified host or set multiple hosts to share the parameter information. All clients compete to obtain TCP/IP parameter information. The client host sends a request to the local network through UDP broadcast. After receiving the request, the server rents the TCP/IP information to the client based on the configuration. The time is limited, after the lease term expires, the client can send a request again to the server for renewal. In the first chapter of this book, during the implementation of large-scale deployment of the operating system, the DHCP service must be used to automatically and dynamically allocate network parameter information to a large number of hosts. Using the DHCP service in the enterprise office environment can help employees achieve mobile office. No matter the desktop, laptop, or tablet computer, they can automatically obtain network parameters as long as they access the network.
1. Install software
The dhcp package provides all the DHCP protocols. The main configuration file is/etc/dhcp/dhcpd. conf, the default file is not configured template, if you need to refer to the template can use/usr/share/doc/dhcp-4.1.1/dhcpd. conf. sample as a reference template,/var/lib/dhcpd. the leases file stores the data records allocated to the client.

 
 
  1. [root@centos6 ~]# yum -y install dhcp 

2. parsing configuration files
Because the default configuration file does not have a module, we can use the dhcpd. conf. sample file as a template to modify the server configuration. The configuration file consists of three parts: global settings, subnet definition, and host definition. The subnet and host definition can have multiple items. The main function of the DHCP server is to provide network parameter data for the local network. Next we will analyze the parameter Meanings of the template file. The semicolon Terminator is used at the end of all the main settings.

 
 
  1. # Dhcpd. conf
  2. # Define global parameters: default search domain
  3. Option domain-name "example.org ";
  4. # Define global parameters: Domain Name Server
  5. Option domain-name-server ns1.example.org, ns2.example.org;
  6. # Define global parameters: Default lease period, in seconds
  7. Default-lease-time 600;
  8. # Define global parameters: Maximum lease period, in seconds
  9. Max-lease-time 7200;
  10. # Define the 10.152.187.0/255.255.255.0 subnet, but no parameters are set for this Subnet
  11. Subnet 10.152.187.0 netmask 255.255.255.0 {
  12. }
  13. # Define 10.254.239.0/255.255.255.255.255.255.255.subnet. The IP address pool is 10.254.239.10 to 19.254.239.20,
  14. # Default gateway for rtr-239-0-1.example.org, rtr-239-0-2.example.org
  15. Subnet 10.254.239.0 netmask has been released successfully {
  16. Range 10.254.239.10 10.254.239.20;
  17. Option routers rtr-239-0-1.example.org, rtr-239-0-2.example.org;
  18. }
  19. # Define the IP address pool 10.5.5.26 to 10.5.5.30,
  20. # The DNS server is ns1.internal.example.org, the default gateway is 10.5.5.1, and the broadcast address is 10.5.5.31,
  21. # Default lease period: 600 seconds; maximum lease period: 7200 seconds,
  22. # When the parameters in the subnet definition conflict with the global parameters, the subnet definition parameters shall prevail.
  23. Subnet 10.5.5.0 netmask has been released successfully {
  24. Range 10.5.5.26 10.5.5.30;
  25. Option domain-name-servers ns1.internal.example.org;
  26. Option domain-name "internal.example.org ";
  27. Option routers 10.5.5.1;
  28. Option broadcast-address 10.5.5.31;
  29. Default-lease-time 600;
  30. Max-lease-time 7200;
  31. }
  32. # Host definition item: defines the host fantasia and binds a fixed IP address to the client through the MAC address of the host,
  33. # After the host requests an IP address from the server, it obtains the fixed IP address specified by fixed-address.
  34. # When multiple hosts are defined, the host name must be unique.
  35. Host fantasia {
  36. Hardware ethernet 08: 00: 07: 26: c0: a5;
  37. Fixed-address fantasia.fugue.com;
  38. }

3. DHCP Application Case
Recently, ABC network plans to re-plan the network environment. Because the previous environment was manually configured with network parameters, some employees in the company had no idea about computer expertise, some simple network faults often consume a lot of energy and time for network maintenance personnel, such as IP address conflicts and incorrect gateway settings. In view of the frequent occurrence of such problems, the company decided to deploy the DHCP service in the company, so that all employees can access the network on a zero-configuration basis, however, a fixed IP address is required for several file servers and printing servers within the company. Company topology 1.

650) this. width = 650; "border =" 0 "width =" 516 "height =" 339 "alt =" dhcp service "src =" http://www.bkjia.com/uploads/allimg/131228/0200052Z1-0.png "/>

 
 
  1. [root@centos6 ~]# yum -y install dhcp 
  2. [root@centos6 ~]# vim /etc/dhcp/dhcpd.conf 
  3. #dhcpd.conf 
  4. default-lease-time 600; 
  5. max-lease-time 7200; 
  6. subnet 172.16.0.0 netmask 255.255.0.0 { 
  7.         range 172.16.0.100 172.16.0.200; 
  8.         option domain-name-servers 202.106.0.20, 202.106.46.151; 
  9.         option domain-name "abc.com"; 
  10.         option routers 172.16.0.1; 
  11.         option broadcast-address 172.16.255.255; 
  12. host fileserver { 
  13.         hardware ethernet 00:0C:5D:71:C4:3F; 
  14.         fixed-address 172.16.0.10; 
  15. host printserver { 
  16.         hardware ethernet 00:0C:5D:71:C4:3E; 
  17.         fixed-address 172.16.0.20; 
  18. [root@centos6 ~]# service dhcpd restart 
  19. [root@centos6 ~]# chkconfig dhcpd on 

So far, the DHCP service has been configured, and all the company's customer hosts can achieve zero-configuration access to the network by setting dynamic access to obtain network parameters.

This article from the "ding Adventure" blog, please be sure to keep this source http://manual.blog.51cto.com/3300438/1174324

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.