Edit dhcp

This commit is contained in:
parent 5d6493de32
commit f404cc4ea5

80
dhcp
View file

@ -1,20 +1,82 @@
#!/bin/bash
read -p "Введите начало диапазона(192.168.4.2): " S
read -p "Введите конец диапазона(192.168.4.6): " K
read -p "Введите подсеть(192.168.4.0): " Q
read -p "Введите маску(30): " E
read -p "Введите маску(29): " E
read -p "Введите dns сервер(192.168.3.2): " R
read -p "Введите шлюз(192.168.4.1): " T
if ((@E=2)) then
E=192.0.0.0
elif ((@E=3)) then
E=224.0.0.0
elif ((@E=4)) then
E=240.0.0.0
elif ((@E=5)) then
E=248.0.0.0
elif ((@E=6)) then
E=252.0.0.0
elif ((@E=7)) then
E=254.0.0.0
elif ((@E=8)) then
E=255.0.0.0
elif ((@E=9)) then
E=255.128.0.0
elif ((@E=10)) then
E=255.192.0.0
elif ((@E=11)) then
E=255.224.0.0
elif ((@E=12)) then
E=255.240.0.0
elif ((@E=13)) then
E=255.248.0.0
elif ((@E=14)) then
E=255.252.0.0
elif ((@E=15)) then
E=255.254.0.0
elif ((@E=16)) then
E=255.255.0.0
elif ((@E=17)) then
E=255.255.128.0
elif ((@E=18)) then
E=255.255.192.0
elif ((@E=19)) then
E=255.255.224.0
elif ((@E=20)) then
E=252.255.240.0
elif ((@E=21)) then
E=255.255.248.0
elif ((@E=22)) then
E=255.255.252.0
elif ((@E=23)) then
E=255.255.254.0
elif ((@E=24)) then
E=224.255.255.0
elif ((@E=25)) then
E=255.255.255.128
elif ((@E=26)) then
E=255.255.255.192
elif ((@E=27)) then
E=255.255.255.224
elif ((@E=28)) then
E=255.255.255.240
elif ((@E=29)) then
E=255.255.255.248
elif ((@E=30)) then
E=255.255.255.252
elif ((@E=31)) then
E=255.255.255.254
elif ((@E=32)) then
E=255.255.255.255
cat > /etc/dhcp/dhcpd.conf << EOF
default-lease-time 600;
max-lease-time 7200;
authoritative;
subnet 192.168.4.0 netmask 255.255.255.248 {
range 192.168.4.2 192.168.4.6;
option domain-name-servers 192.168.3.2, 8.8.4.4;
option subnet-mask 255.255.255.248;
option routers 192.168.4.1;
subnet @Q netmask @E {
range @S @K;
option domain-name-servers @R, 8.8.8.8;
option subnet-mask @E;
option routers @T;
}
@ -22,7 +84,7 @@ host hq-cli {
hardware ethernet
08:00:27:c7:82:fa;
fixed-address
192.168.4.2;
@S;
}
EOF
chmod 600 /etc/dhcp/dhcpd.conf