标签:echo else 火墙 exit 镜像 ase def router dhcpd
执行前提是:
关闭防火墙和selinux
配置好本机IP
配置本地原iso镜像文件
vim /etc/fstab写入:
/dev/cdrom /mnt/cdrom iso9660 defaults loop 0 0
以下是脚本内容:
#!/bin/sh
echo "
1. install dhcp
2. configer dhcp
"
echo "Please input you choice:"
read shu
if [ $shu -eq 1 ]; then
mkdir /mnt/cdrom
rm -rf /etc/yum.repos.d/*
cd /etc/yum.repos.d
touch my.repo
echo "[my_repo]" > /etc/yum.repos.d/my.repo
echo "name=my local repo" >> /etc/yum.repos.d/my.repo
echo "baseurl=file:///mnt/cdrom" >> /etc/yum.repos.d/my.repo
echo "enabled=1" >> /etc/yum.repos.d/my.repo
echo "gpgchech=0" >> /etc/yum.repos.d/my.repo
mount /dev/cdrom /mnt/cdrom -o loop
yum install dhcp -y
elif [ $shu -eq 2 ];then
echo "please input your subnet:"
read subnet
echo "please input you netmask"
read netmask
echo "subnet $subnet netmask $netmask" >> /etc/dhcp/dhcpd.conf
echo "{" >> /etc/dhcp/dchpd.conf
echo "please input you ip range:"
read range
echo " range $range" >> /etc/dhcp/dhcpd/conf
echo "pkease input your option routers:"
read routers
echo " option routers $routers;" >> /etc/dhcp/dhcpd.conf
echo "default-lease-time:"
read xianzhi
echo "default-lease-time $xianzhi;" >> /etc/dhcp/dhcpd.conf
else
exit
fi
标签:echo else 火墙 exit 镜像 ase def router dhcpd
原文地址:https://www.cnblogs.com/fzlsss/p/9279901.html