Centos6.5-install DHCPServer,

Source: Internet
Author: User

Centos6.5-install DHCPServer,

1. Check whether dhcp has been installed.

[Zfp @ localhost ~] $ Rpm-q dhcp
Package dhcp is not installed
[Zfp @ localhost ~] $

2. query dhcp-related rpm packages in the yum network source.

[Root @ localhost zfp] # yum list | grep dhcp
Dhcp. x86_64. 1.1-53. P1.el6. centos.1 updates
Dhcp-common.x86_64. 1.1-53. P1.el6. centos.1 updates
Dhcp-devel.i686. 1.1-53. P1.el6. centos.1 updates
Dhcp-devel.x86_64. 1.1-53. P1.el6. centos.1 updates
Sblim-cmpi-dhcp.i686 1.0-1. el6 base
Sblim-cmpi-dhcp.x86_64 1.0-1. el6 base
Sblim-cmpi-dhcp-devel.i686 1.0-1. el6 base
Sblim-cmpi-dhcp-devel.x86_64 1.0-1. el6 base
Sblim-cmpi-dhcp-test.x86_64 1.0-1. el6 base

3. Install dhcp

[Root @ localhost zfp] #Yum install dhcp-y

4. Check whether the installation is successful.

[Root @ localhost zfp] # rpm-q dhcp
Dhcp-4.1.1-53.P1.el6.centos.1.x86_64
[Root @ localhost zfp] #

Query the installed rpm package containing the dhcp string package name
[Root @ localhost zfp] # rpm-qa | grep dhcp
Dhcp-common-4.1.1-53.P1.el6.centos.1.x86_64
Dhcp-4.1.1-53.P1.el6.centos.1.x86_64

5. modify the configuration file/etc/dhcp/dhcpd. conf.

Different releases may not be the/etc/dhcp/dhcpd. conf file, or the/etc/dhcpd. conf file. The centos6.5 release version is/etc/dhcp/dhcpd. conf.

[Root @ localhost zfp] #Vim/etc/dhcp/dhcpd. conf

Ddns-update-style interim; # indicates the dynamic information update mode of the dhcp server and dns Server

Ignore client-updates; # ignore client updates

Subnet 192.168.145.0 netmask 255.255.255.0 {# indicates that the IP address I allocated is in the CIDR Block 192.168.145.0 and the subnet mask is 255.255.255.0.

Range 192.168.145.200 192.168.145.210; # The range of rented IP addresses

Option domain-name-servers 8.8.8.8;

Option domain-name "example.org ";

Option routers 192.168.145.100; # vro address, which is the IP address of the current dhcp server

Option subnet-mask limit 255.0; # subnet mask

Default-lease-time 600; # default lease time

Max-lease-time 7200; # maximum lease time

# Host myhost {# Set host Declaration

# Hardware ethernet 08: 00: 27: 2C: 30: 8C; # specify the mac address of the dhcp Client

# Fixed-address 192.168.145.155; # assign an ip address to the specified mac address

#}

}


[Root @ localhost zfp] #Vim/etc/sysconfig/dhcpd
DHCPDARGS = eth0 # specify to provide the dhcpserver service on the eth0 Nic

6. Enable the dhcp service.

[Root @ localhost zfp] #Service dhcpd status
Dhcpd (pid 4478) is running...
[Root @ localhost zfp] #

If an error is reported, check what error is reported when the dhcp service is enabled.Cat/var/log/messagesOrTail-f/var/log/messages &

The following is the log information for enabling the dhcp service normally:

Jan 1 03:09:42 localhost dhcpd: Internet Systems Consortium DHCP Server 4.1.1-P1
Jan 1 03:09:42 localhost dhcpd: Copyright 2004-2010 Internet Systems Consortium.
Jan 1 03:09:42 localhost dhcpd: All rights reserved.
Jan 1 03:09:42 localhost dhcpd: For info, please visit https://www.isc.org/software/dhcp/
Jan 1 03:09:42 localhost dhcpd: Not searching LDAP since ldap-server, ldap-port and ldap-base-dn were not specified in the config file
Jan 1 03:09:42 localhost dhcpd: Wrote 0 leases to leases file.
Jan 1 03:09:42 localhost dhcpd: Listening on LPF/eth0/00: 0c: 29: 9b: 2d: be/192.168.145.0/24
Jan 1 03:09:42 localhost dhcpd: Sending on LPF/eth0/00: 0c: 29: 9b: 2d: be/192.168.145.0/24
Jan 1 03:09:42 localhost dhcpd: Sending on Socket/fallback-net

[Root @ localhost network-scripts] # netstat-anulp | grep: 67
Udp 0 0 0.0.0.0: 67 0.0.0.0: * 4591/dhcpd
[Root @ localhost network-scripts] #

End Of File

 

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.