洛浦網(wǎng)站建設(shè)公司創(chuàng)新互聯(lián),洛浦網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為洛浦成百上千家提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\外貿(mào)網(wǎng)站建設(shè)要多少錢(qián),請(qǐng)找那個(gè)售后服務(wù)好的洛浦做網(wǎng)站的公司定做!
#!/bin/bash
yum install dhcp -y //安裝DHCP服務(wù)
yum install expect -y //安裝expect工具
/usr/bin/expect <<-EOF
spawn cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf
//spawn追蹤后面的命令
expect{ //匹配
"cp*" //用“*”代表后面一長(zhǎng)串命令
{send "yes\r"} //交互式輸入yes '\r’代表回車(chē)
}
expect eof
EOF
cat <<-EOF >> /etc/dhcp/dhcpd.conf //在DHCP配置文件中寫(xiě)入命令
subnet 192.168.100.0 netmask 255.255.255.0 { //網(wǎng)段,子網(wǎng)掩碼
range 192.168.100.20 192.168.100.200; //網(wǎng)段范圍
option routers 192.168.100.1; //網(wǎng)關(guān)
EOF
}
EOF
systemctl stop firewalld.service //關(guān)閉防火墻
setenforce 0 //關(guān)閉增強(qiáng)功能
systemctl start dhcpd //開(kāi)啟DHCP服務(wù)