preparation-scripts/installation/dhcp.sh

22 lines
548 B
Bash
Raw Normal View History

2024-11-18 20:14:39 +01:00
#!/bin/bash
sudo apt update
sudo apt install -y isc-dhcp-server
2024-11-18 20:17:34 +01:00
config="default-lease-time 600; \
2024-11-18 20:14:39 +01:00
max-lease-time 7200; \
\
subnet 192.168.1.0 netmask 255.255.255.0 { \
range 192.168.1.10 192.168.1.100; \
option routers 192.168.1.1; \
option subnet-mask 255.255.255.0; \
option domain-name-servers 8.8.8.8, 8.8.4.4; \
}"
2024-11-18 20:22:57 +01:00
echo -e 'INTERFACES="enp0s3"' | sudo tee /etc/default/isc-dhcp-server >/dev/null
2024-11-18 20:16:54 +01:00
echo -e "$config" | sudo tee /etc/dhcp/dhcpd.conf >/dev/null
2024-11-18 20:18:51 +01:00
2024-11-18 20:22:57 +01:00
systemctl start isc-dhcp-server
systemctl enable isc-dhcp-server