Shell脚本——DHCP自动部署

详细说明参考:

(三)跟我一起玩Linux网络服务:DHCP服务配置之主服务器配置

 1 #! /bin/bash
 2 IPSAG="10.10.10"
 3 DNSIP="10.10.10.10"
 4 DN="ns.gr.org"
 5 cat  >  /etc/dhcpd.conf << +END+
 6 ddns-update-style interim;
 7 ignore client-updates;
 8 subnet $IPSAG.0 netmask 255.255.255.0 {
 9         option routers                  $DNSIP;
10         option subnet-mask              255.255.255.0;
11         option domain-name              "$DN";
12         option domain-name-servers      $DNSIP;
13         option time-offset              28800;
14         range dynamic-bootp $IPSAG.100 $IPSAG.200;
15         default-lease-time 21600;
16         max-lease-time 43200;
17         host boss {
18                 next-server marvin.redhat.com;
19                 hardware ethernet 12:34:56:78:AB:CD;
20                 fixed-address 207.175.42.188;
21         }
22 }
23 +END+
24 service dhcpd restart
25 ps -ax | grep dhcpd
原文地址:https://www.cnblogs.com/miao-zp/p/4445534.html