Install the dhcp server on Centos/Ubuntu (Not configured to listen on any interfaces !)

Source: Internet
Author: User

Install the dhcp server on Centos/Ubuntu (Not configured to listen on any interfaces !)

A soft routing service is being developed recently. One of the features is the dhcp service. Record the process for your reference.

(Dhcpd version 4.1.1 and centos version 6.6)

Body:

(1) install dhcp

Ubuntu uses apt-get and centos uses yum.

(2) Start and start the service

Set dhcpd to boot, and run the chkconfig dhcpd on command under centos;

For how to set startup in ubuntu, please google.

If you want to enable the service immediately, service dhcpd start;

(3) Add a configuration file

After installing dhcpd. The default configuration file has no content, so service dhcpd start reports an error.

Two error messages are as follows:

No subnet declaration for eth5 (192.168.106.221)

Not configured to listen on any interfaces!

The reason is that we have not set the configuration file.

You can put/usr/share/doc/dhcp-4.1.1/dhcpd. conf. sample

Copy to/etc/dhcp/dhcpd. conf (the configuration file location may be different for different releases ).

(4) modify the configuration file

If the configuration file is not modified, an error will still be reported when dhcpd is started.

You can refer to another user's dhcpd. conf file for modification.

Because I am working on a vro, there are many NICs, and the parameters are complicated, so I will not post them.

Next, paste it to someone else. This is easier to understand:

 

Ddns-update-style interim; # configure to use the transitional DHCP-DNS interactive update mode. Ignore client-updates; # ignore client updates subnet 192.168.1.0 netmask 255.255.255.0 {option routers 192.168.1.1; # vro address option subnet-mask 255.255.255.0; # subnet mask option nis-domain "xfbaydhcp.com "; option domain-name "xfbaydhcp.com"; # domain name option domain-name-servers 202.102.152.3; # DNS address option time-offset-18000; # Eastern Standard Time range dynamic-bootp 192.168.1.100 192.168.1.200; # The lease IP address range is default-lease-time 21600; # The default lease time is max-lease-time 43200; # maximum lease time # we want the nameserver to appear at a fixed address host ns {next-server marvin.redhat.com; hardware ethernet 12: 34: 56: 78: AB: CD; fixed-address 207.175.42.254 ;}}


 

(5) bind a lan Nic to a dhcpd

Not configured to listen on any interfaces!

The cause of this error is that no dhcp function is declared on which Nic is enabled.

Solution:

Add a row in/etc/sysconfig/dhcpd

 

DHCPDARGS=eth4
This is the path in centos, which may be a bit different in ubuntu.

 

After these modifications, the service dhcpd start; can start the service.
 

(6) Appendix: dhcpd. conf parameter description

 

/Etc/dhcpd. conf usually includes three parts: parameters, declarations, and option. 1. parameters (parameters) in the DHCP configuration file: shows how the task is executed, whether the task is to be executed, or which network configuration options are sent to the customer 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, provide the customer's IP address, and other shared-network to tell whether 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. The name of the file whose filename starts to start. 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 use the option keyword as the start subnet-mask to set 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 the client.


 

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.