zoukankan      html  css  js  c++  java
  • 交互脚本DHCP配置

    #!/bin/bash
    #山楂树之恋
    #2019-8-26
    #构建轰趴yum
    read -p "请输入你的挂载点" dir
    echo "正在挂载。。。。。"
    mount | grep -q "/dev/sr0" && umount /dev/sr0
    [ -d $dir ] || mkdir dir
    mount /dev/sr0 $dir &> /dev/null
    echo "挂载成功"
    cd /etc/yum.repos.d/
    [ -d likun ] || mkdir likun
    mv C* likun
    cat << EDF > local.repo
    [xxx]
    name=xxx
    baseurl=file://$dir
    enabled=1
    gpgcheck=0
    EDF
    echo "清除小朋友"
    yum clean all &> /dev/null
    echo "构建轰趴基地yum"
    yum makecache &> /dev/null
    echo "构建成功"
    #安装DHCP
    echo "是否有DHCP,没有将进行安装"
    yum -y instll dhcp &> /dev/null
    if [ $(rpm -q dhcp ) = "dhcp-4.2.5.el7.centos.x86_64" ] &> /dev/null
    then echo "安装完成"
    fi
    echo "修改主配置文件,q请输入你的机器内容"
    read -p "请输入吗要分配的域名(例如:crushlinux.com): "  a
    read -p "请输入你要分配的网段吧(192.168.100):  "  b
    read -p "请输入吗要分配的IP范围( 例如 10  100 ) "  cc  mm
    read -p "请输入你的路由网关( 192.168.100.1) "  s
    cat << EDF > /etc/dhcp/dhcp.conf
    option domain-name "$a";
    option domain-name-servers 202.106.0.20,8.8.8.8;
    default-lease-time 21600;
    max-lease-time 43500;
    subnet $b.0 netmask 255.255.255.0 {
    range $ $b.$cc $b.$mm;
    option routers $s;
    }
    EDF
    #启动 DNCP
    echo "重启服务--开机自启动中............."
    systemctl start dhcpd &> /dev/null
    systemctl restart dhcpd &> /dev/null
    systemctl enable dhcpd &> /dev/null
    systemctl status dhcpd | grep running &> /dev/nill
    echo "亲! DHCP服务已经启动"
  • 相关阅读:
    Spring 实践 -IoC
    HDU1584:蜘蛛牌(DFS)
    Linux命令缩写来由
    一道面试题:用shell写一个从1加到100的程序
    常用的OpenCV函数速查
    等差数列/等比数列通项公式与求和公式
    ubuntu给手机建wifi
    [转]C++之运算符重载(2)
    [转]C++之运算符重载(1)
    [转]C++之多态性与虚函数
  • 原文地址:https://www.cnblogs.com/123456likun/p/11411368.html
Copyright © 2011-2022 走看看