Configure DHCP server
This commit is contained in:
parent
a0ad9fd88b
commit
bab23f75eb
5 changed files with 65 additions and 0 deletions
14
build.sh
14
build.sh
|
@ -244,6 +244,8 @@ chmod 644 "$ROOTFS_DIR/etc/hostname"
|
|||
|
||||
echo "127.0.1.1 $HOSTNAME" >>"$ROOTFS_DIR/etc/hosts"
|
||||
|
||||
install -m 644 files/interfaces.d/eth0 "$ROOTFS_DIR/etc/network/interfaces.d/"
|
||||
|
||||
##
|
||||
# Add user.
|
||||
#
|
||||
|
@ -318,6 +320,18 @@ systemctl disable hwclock.sh
|
|||
fake-hwclock save
|
||||
EOF
|
||||
|
||||
##
|
||||
# ISC DHCP server
|
||||
#
|
||||
on_chroot << EOF
|
||||
apt-get install -y isc-dhcp-server
|
||||
EOF
|
||||
|
||||
apply_patch '06-dhcp-server.diff'
|
||||
|
||||
install -d "$ROOTFS_DIR/etc/dhcp/dhcpd.conf.d/"
|
||||
install -m 644 files/dhcpd.conf.d/192.168.82.0.conf "$ROOTFS_DIR/etc/dhcp/dhcpd.conf.d/"
|
||||
|
||||
##
|
||||
# Unmount virtual file systems.
|
||||
#
|
||||
|
|
6
files/dhcpd.conf.d/192.168.82.0.conf
Normal file
6
files/dhcpd.conf.d/192.168.82.0.conf
Normal file
|
@ -0,0 +1,6 @@
|
|||
subnet 192.168.82.0 netmask 255.255.255.0 {
|
||||
range 192.168.82.2 192.168.82.254;
|
||||
|
||||
option routers 192.168.82.1;
|
||||
option broadcast-address 192.168.82.255;
|
||||
}
|
8
files/interfaces.d/eth0
Normal file
8
files/interfaces.d/eth0
Normal file
|
@ -0,0 +1,8 @@
|
|||
auto eth0
|
||||
allow-hotplug eth0
|
||||
iface eth0 inet static
|
||||
netmask 255.255.255.0
|
||||
network 192.168.82.0
|
||||
gateway 192.168.82.1
|
||||
broadcast 192.168.82.255
|
||||
address 192.168.82.1
|
36
patches/06-dhcp-server.diff
Normal file
36
patches/06-dhcp-server.diff
Normal file
|
@ -0,0 +1,36 @@
|
|||
--- rootfs.orig/etc/dhcp/dhcpd.conf
|
||||
+++ rootfs/etc/dhcp/dhcpd.conf
|
||||
@@ -10,20 +10,22 @@
|
||||
ddns-update-style none;
|
||||
|
||||
# option definitions common to all supported networks...
|
||||
-option domain-name "example.org";
|
||||
-option domain-name-servers ns1.example.org, ns2.example.org;
|
||||
+option domain-name "barnacleos.local";
|
||||
+option domain-name-servers 8.8.8.8, 8.8.4.4;
|
||||
|
||||
default-lease-time 600;
|
||||
max-lease-time 7200;
|
||||
|
||||
# If this DHCP server is the official DHCP server for the local
|
||||
# network, the authoritative directive should be uncommented.
|
||||
-#authoritative;
|
||||
+authoritative;
|
||||
|
||||
# Use this to send dhcp log messages to a different log file (you also
|
||||
# have to hack syslog.conf to complete the redirection).
|
||||
log-facility local7;
|
||||
|
||||
+include "/etc/dhcp/dhcpd.conf.d/192.168.82.0.conf";
|
||||
+
|
||||
# No service will be given on this subnet, but declaring it helps the
|
||||
# DHCP server to understand the network topology.
|
||||
|
||||
--- rootfs.orig/etc/default/isc-dhcp-server
|
||||
+++ rootfs/etc/default/isc-dhcp-server
|
||||
@@ -18,4 +18,4 @@
|
||||
|
||||
# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
|
||||
# Separate multiple interfaces with spaces, e.g. "eth0 eth1".
|
||||
-INTERFACES=""
|
||||
+INTERFACES="eth0"
|
|
@ -3,3 +3,4 @@
|
|||
03-useradd.diff
|
||||
04-swap.diff
|
||||
05-path.diff
|
||||
06-dhcp-server.diff
|
||||
|
|
Reference in a new issue