Detailed configuration of the DHCP server under FreeBSD (figure)

Source: Internet
Author: User
Tags touch command
Article Title: detailed configuration of the DHCP server under FreeBSD (figure ). 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.
We have introduced the installation of FreeBSD in the previous article. This document describes how to configure and use the FreeBSD system-based DHCP service.
  
   1. Brief understanding of DHCP
  
DHCP is short for Dynamic Host Configuration Protocol (Dynamic Host Configuration Protocol. It is mainly used to centrally allocate IP addresses and IP address-related information to multiple customers' computers. It is often used to manage many DOS/Windows computers in the network, this saves the trouble of manually setting and allocating addresses for network administrators.
  
Everything has both advantages and disadvantages. DHCP also has disadvantages. For example, a DHCP client does not have a fixed IP address, but the IP address that is frequently changed is not suitable for servers that provide network services. In addition, the current DNS Protocol cannot work with DHCP to directly provide host name resolution tasks for DHCP clients.
  
   Ii. configuration process
  
In the Packages Collection of FreeBSD, there are two different DHCP clients and server software, one for the ISC-DHCP, the other for the WIDE-DHCP, both included the DHCP client software and server software, the ISC-DHCP is more commonly used, the following uses the ISC-DHCP as an example to describe how to install and set DHCP on FreeBSD.
  
In addition, to enable the FreeBSD system to support DHCP, you must check whether the system kernel supports the pseudo-device bpfilter. It is an interface that allows applications to receive original packets from the network, in this way, the application can receive data packets whose destination address is not a local IP address.
  
So why does DHCP support bpfilter? Because the computer does not define an IP address before DHCP sets the computer's TCP/IP, the TCP/IP stack itself does not receive packets that do not have the local IP address. To receive the packet sent from the DHCP server back to the client, you must bypass the TCP/IP stack and use the pseudo-device bpfilter.
  
Step 1: Customize the bpfilter kernel.
    
Step 2: Ensure that the device files under the/dev/directory have the corresponding bpfilter.
    
Step 3: Install the dhcpd, dhclient, and dhcprelay files required by DHCP in the Packages Collecion package to the/usr/local/sbin directory.
    
Step 4: Set the configuration file/etc/dhcpd. conf.
    
Explanation:
  
"Server-identifier 192.168.3.1" is the IP address of the local server. Generally, you do not need to set this parameter. dhcpd can automatically detect this parameter.
  
The "Subnet" field specifies a sub-network segment. The IP address range of I P that can be allocated by the DHCP server is 192.168.3.10 to 192.168.3.20. This IP address range can also be non-consecutive. You can use multiple range setting parameters to set discontinuous IP addresses. In addition, the default-lease-time and max-lease-time limits of IP addresses allocated in this group are also set. The default values are 600 and 7200. The option parameter below is an additional function of DHCP. For example, in this example, set the subnet mask of a DHCP client to 255.255.255.0, the broadcast address to 192.168.3.1, the DNS server address to 192.168.3.1, and the domain name to exampleorg.org.cn.
  
Set the "host a1" field for a specific host A1. The host is bound to the computer with the MAC address of the network card used, and a fixed address is assigned to it. This allocation method is actually equivalent to the fixed address allocation method. The only advantage is that the IP address can be centrally managed without being set by each computer. You can also use the option parameter to set parameters such as the subnet mask described in the previous field.
Step 5: After the dhcpd. conf file is configured, The dhcpd daemon can be started. Because the computer has multiple network interfaces, You need to specify the network interface of the dhcpd server to respond to DHCP requests on the corresponding interface.
    
Step 6: After that, when dhcpd is running normally, records of each customer request and the IP address allocated in its response are recorded in the/var/run/dhcpd. leases file. To enable dhcpd to record logs normally, you should also use the touch command before starting dhcpd to generate a new log file. So that you can view the content of this log file in the future to obtain the current DHCP server status and Client IP Address allocation. Sample log file:
  
   Postscript:
  
After the preceding configuration, you can set the client in the network to use the DHCP protocol of FreeBSD to obtain the valid IP address. Generally, the DHCP protocol can be directly configured in the TCP/IP Settings of Windows computers. If the client system is Linux (including FreeBSD), dhclient is required. This article will not detail it in detail. If you are interested, please refer to the DHCP configuration of Linux and other systems on the client.
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.