Script implementation easy to configure Dhcp-server

Source: Internet
Author: User

#!/bin/bash

Echo ' The script is install DHCPD server '

Read-p "Please insert RHEL5-CD-cdrom and enter to next:" AA

mount/dev/cdrom/media/&>/dev/null

rpm-uvh/media/server/dhcp-* &>/dev/null

echo "Please configure IP address for this machine"

Read-p "Please enter IP address:" IP

Read-p "Please enter the Mask:" Ip_mask

macaddr=$ (ifconfig eth0 |grep Eth0|awk ' {print $} ')

Cat >/etc/sysconfig/network-scripts/ifcfg-eth0 <<eof

Device=eth0

Onboot=yes

Bootproto=static

Ipaddr= $ip

netmask= $ip _mask

Hwaddr= $MACADDR

Eof

echo "Enabling new configured IP address for you"

Ifdown eth0;ifup eth0

echo "IP address already in effect"

Read-p "Configure the network segment for DHCP:" Dhcp_net

Read-p "Please configure the Mask for DHCP:" Dhcp_mask

Read-p "Configure your gateway for DHCP:" DHCP_GW

Read-p "Please assign the start IP to DHCP configuration:" Dhcp_bigin

Read-p "Configure end IP for DHCP:" Dhcp_over

The configuration file for cat >/etc/dhcpd.conf <<eof//DHCP3 is installed by default in/etc, and DHCP4 is installed under/ETC/DHCP, paying attention to its path

Ddns-update-style Interim;

Ignore client-updates;

Subnet $dhcp _net netmask $dhcp _mask {

option Routers $DHCP _GW;

Option Subnet-mask $dhcp _mask;

Range $dhcp _bigin $dhcp _over;

Default-lease-time 21600;

Max-lease-time 43200;

}

Eof

Service DHCPD Start &>/dev/null

NETSTAT-ANPL |grep:67


This article is from the "Dragon Love Xue qi" blog, please make sure to keep this source http://dragon123.blog.51cto.com/9152073/1583486

Script implementation easy to configure 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.