Linux Build DHCP server

Source: Internet
Author: User

first assume that the DHCP server IP is 192.168.80.20/24.

1. Installing the DHCP server software

Mount/dev/cdrom/mnt

rpm-ivh/mnt/packages/dhcp-4.1.1-34.p1.el6.i686.rpm

2. Modify the configuration

(1) View file hints cat/etc/dhcp/dhcpd.conf

copy template files to dhcp.conf

Cp/usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample/etc/dhcp/dhcpd.conf


(2) Remove # and Blank lines from dhcpd.conf

Cd/etc/dhcp

Grep-v "#" dhcpd.conf | Grep-v "^$" > Dhcpd.conf.back

Overwrite original file cp Dhcpd.conf.back dhcpd.conf


(3) Modify The dhcpd.conf file configuration

VI dhcpd.conf

In order to keep the address before the #, make it a note, note the end of the sentence plus ";"

Option Domain-name-servers 8.8.8.8,9.9.9.9; Server Dns

Default-lease-time 600;

Subnet 192.168.80.0 netmask 255.255.255.0 { Scope network segment

Range 192.168.80.100 192.168.80.200; Address Pool

Option Domain-name-servers 10.10.10.10,1.1.1.1; Dns

Option routers 192.168.80.1; Gateway

Default-lease-time 600; Lease Time

}

# host prtsvt{

#hardware Ethernet;

# fixed-address 192.168.80.188;

}

Save.


3. start The DHCP service

Service DHCP Start

If there is a definite indication of success

In the event of a failure, view the log and modify the configuration content as above

Cat/var/log/messages

on the real machine will The IP address is set to be automatically obtained, and the IP address can be tested for distribution .


4. Test The DHCP reserved block.

Vi/etc/dhcp/dhcpd.conf

Remove the # before the reserved block

Option Domain-name-servers 8.8.8.8,9.9.9.9; Server Dns

Default-lease-time 600;

Subnet 192.168.80.0 netmask 255.255.255.0 { Scope network segment

Range 192.168.80.100 192.168.80.200; Address Pool

Option Domain-name-servers 10.10.10.10,1.1.1.1; Scope DNS

Option routers 192.168.80.1; Gateway

Default-lease-time 600; Lease Time

}

Host prtsvt{

Hardware Ethernet The Mac address of the real computer network card ;

Fixed-address 192.168.80.188; Suppose the reserved address is 192.168.80.188

}

Note change the Mac address "-" to ":"

Save, restart DHCP service : Service DHCP restart

Appear identified as successful

A failure occurs, review the log, modify the configuration as above.

Restart the network card of the real machine to see if the block address is reserved.


This article is from the "Ne Road" blog, please be sure to keep this source http://332162926.blog.51cto.com/8831013/1441080

Linux Build DHCP server

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.