summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2016-08-09 09:59:01 +0300
committerLars Wirzenius <liw@liw.fi>2016-08-09 09:59:01 +0300
commitbff48c1a12919c66de2f8891d538eb9203720940 (patch)
tree6a3172fd674a32564c5856019181a362d5e736ef
parent1f7c7538035182ba2052f24e31604f03376f8721 (diff)
downloadminipc-router-bff48c1a12919c66de2f8891d538eb9203720940.tar.gz
Configure LAN2-4 to provide DHCP for LAN
-rwxr-xr-xrouter.customize36
1 files changed, 36 insertions, 0 deletions
diff --git a/router.customize b/router.customize
index 2a5dc26..02a64a3 100755
--- a/router.customize
+++ b/router.customize
@@ -31,6 +31,42 @@ export LC_ALL=C
rootdir="$1"
+# Configure network ports. eth0 is WAN and gets its adress using DHCP.
+# The rest will serve the LAN and dnsmasq will serve address to LAN via
+# DHCP on these ports. The LAN interfaces have a static config.
+
+cat <<EOF > "$rootdir/etc/network/interfaces.d/router.conf"
+auto eth0
+inet eth0 inet dhcp
+
+auto eth1
+iface eth1 inet static
+ address 10.0.0.2
+ netmask 255.255.255.0
+ gateway 10.0.0.255
+
+auto eth2
+iface eth2 inet static
+ address 10.0.0.3
+ netmask 255.255.255.0
+ gateway 10.0.0.255
+
+auto eth3
+iface eth3 inet static
+ address 10.0.0.4
+ netmask 255.255.255.0
+ gateway 10.0.0.255
+EOF
+
+# Configure dnsmasq to server 10.0.0.x addresss on the LAN ports.
+cat <<EOF > "$rootdir/etc/dnsmasq.d/router.conf"
+interface=eth1
+interface=eth2
+interface=eth3
+dhcp-range=10.0.0.10,10.0.0.250,255.255.255.0,720h
+EOF
+
+
# Create an account for ansible.
chroot "$rootdir" adduser --gecos 'Ansible' --disabled-password ansible