Linux DHCP server configuration

Source: Internet
Author: User

DHCP server configuration

DHCP service is only used in C/s architecture, so a server is required to provide a DHCP server

Note: The system of this DHCP experiment is CentOS 6.6



Linxu DHCP Service installation:

Yum Install DHCP

The DHCP service can be installed with the above command


After the installation is complete, the DHCP service script is DHCPD

Service script:/ETC/RC.D/INIT.D


dhcp,67/udp: Server, 67 ports, working with UDP

dhclient,68/udp: Client, 68 for port, working with UDP

Configuration file:

/etc/dhcp/dhcpd.conf


Now start editing the configuration file, the Linux default configuration file is not configured, you need to edit or copy the configuration file to overwrite the sample file, or the service will not start.

sample file for configuration file:/usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample

Note: There are many syntax errors in the sample file that need to be removed, or the service will not start properly


Configuration file Contents:

----------------------------------------------------------------------------------------------------

The configuration file is not the end of the paragraph need to be appended with a semicolon; Otherwise syntax error


# dhcpd.conf

#

# Sample configuration file for ISC dhcpd

#

# option definitions common to all supported networks.

.

Option Domain-name "example.org";: Domain name, your own search domain


Option Domain-name-servers ns1.example.org, ns2.example.org;:

Name server address multiple server addresses required, comma separated


Default-lease-time 600;: Default lease duration


Max-lease-time 7200;: Maximum lease term


# Use this to enble/disable dynamic DNS updates globally.

#ddns-update-style None;

# IF This DHCP server is the official DHCP server for the local

# Network, the authoritative directive should be uncommented.

#authoritative;

# Use this to send DHCP log messages to a different log file (you also

# has to hack syslog.conf to complete the redirection).


Log-facility local7;: What log facilities are, where are the log files stored


# No Service would be given on this subnet, but declaring it helps the

# DHCP Server to understand the network topology.


Important: The subnet server works in which network, what is configured in this network


Subnet 10.254.239.0 (working with which network) netmask 255.255.255.224 (subnet mask) {

Range 10.254.239.10 10.254.239.20;: Address pool, assigned IP is present in this

Option routers (gateway) 10.254.239.1;

Option domain-name-servers 61.153.177.196;:dns server address

}


-------------------------------------------------------------------------------------------


After the configuration is complete:

Service DHCPD Configtest

Use the above command to test the configuration file syntax, you can start the service

Because there are DHCPD service scripts under/etc/rc.d/init.d/, you can start the service directly using the services DHCPD start


Use a different host test after the start service is complete.


/etc/dhcpd.conf ..... Master configuration file for DHCP server

/ETC/RC.D/INIT.D/DHCPD ..... DHCP service startup scripts

/etc/rc.d/init.d/dhcrelay ..... DHCP Relay service startup script

/ETC/SYSCONFIG/DHCPD ..... DHCP command parameter configuration file

/etc/sysconfig/dhcrelay ..... DHCP Relay Service configuration file

/USR/SBIN/DHCPD ..... DHCP Server Execution Program

/usr/sbin/dhcrelay ..... Execute program for DHCP relay server

/var/lib/dhcpd/dhcpd.leases ..... DHCP server lease file






Linux DHCP server configuration

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.