Configuration of DHCP for shell scripts

Source: Internet
Author: User

Rpm-q DHCP &>/dev/null

If [$?-ne 0]

Then

Yum-y Install DHCP

echo "

Ddns-update-style Interim;

Ignore client-updates;

Option Domain-name-servers 192.168.1.1;

Default-lease-time 21600;

Max-lease-time 43200;


">/etc/dhcpd.conf

Fi

While True

Do

Read-p "Please input network:" Network

grep $network/etc/dhcpd.conf &>/dev/null

If [$?-eq 0];then

Read-p "continue to do? (yes/no) "yn

if [$yn = yes];then

Continue

Else

Break

Fi

Fi

Read-p "Please input gateway:" Gateway

Read-p "Please input netmask:" Netmask

Read-p "Please input start_ip:" Start_ip

Read-p "Please input end_ip:" End_ip

Read-p "Is you sure?" (yes/no) "yn

if [$yn! = yes];then

Continue

Fi

echo "

Subnet $network netmask $netmask {

option routers $gateway;

Option Subnet-mask $netmask;

Range DYNAMIC-BOOTP $start _ip $end _ip;


}


">>/etc/dhcpd.conf

Read-p "Contine to do? (yes/no) "yn

if [$yn = no];then

Break

Fi


Done


Service DHCPD Restart


Configuration of DHCP for shell scripts

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.