preparation-scripts/installation/dhcp.sh
2024-11-23 15:16:52 +01:00

23 lines
587 B
Bash
Executable file

#!/bin/bash
# SPDX-License-Identifier: GPL-3.0-or-later
# Copyright (c) 2024 Interstellar Development
sudo apt update
sudo apt install -y isc-dhcp-server
config="default-lease-time 600;
max-lease-time 7200;
subnet 192.168.16.0 netmask 255.255.255.0 {
range 192.168.16.10 192.168.16.100;
option subnet-mask 255.255.255.0;
option domain-name-servers 192.168.16.1;
}"
echo -e "INTERFACES='$1'" | sudo tee /etc/default/isc-dhcp-server >/dev/null
echo -e "$config" | sudo tee /etc/dhcp/dhcpd.conf >/dev/null
systemctl start isc-dhcp-server
systemctl enable isc-dhcp-server