dhcp/service-install.sh

raw link view readme
1 yum install firewalld -y
2 systemctl start firewalld
3 systemctl enable firewalld
4 firewall-cmd --permanent --add-interface=eth0 --zone=public
5 firewall-cmd --permanent --add-service=dhcp --zone=public
6 firewall-cmd --reload
7
8 yum install dhcp -y
9
10 cat > /etc/dhcp/dhcpd.conf << EOF
11 option domain-name-servers 8.8.8.8;
12 option domain-search "example.net";
13 option routers 10.1.1.254;
14 default-lease-time 86400;
15 max-lease-time 86400;
16 ddns-update-style none;
17 authoritative;
18 log-facility local4;
19 subnet 10.1.0.0 netmask 255.255.0.0 {
20 range 10.1.100.50 10.1.100.200;
21 }
22 ##+ reservation
23 #host lab02 {
24 # hardware ethernet 00:15:5d:01:1f:38;
25 # fixed-address 10.1.1.30;
26 #}
27 EOF
28
29 systemctl start dhcpd
30 systemctl enable dhcpd
31