aboutsummaryrefslogtreecommitdiff
path: root/etc/local.d/00-dhcpcd.start
diff options
context:
space:
mode:
authorMitchell Riedstra <mitch@riedstra.dev>2022-02-23 20:19:37 -0500
committerMitchell Riedstra <mitch@riedstra.dev>2022-02-23 20:43:27 -0500
commit12192865c3ca0e1c2139afabab508e0087b14982 (patch)
tree26ea5454dc976e87186e369685a1ac987bab2a61 /etc/local.d/00-dhcpcd.start
downloadalpine-home-router-master.tar.gz
alpine-home-router-master.tar.xz
Diffstat (limited to 'etc/local.d/00-dhcpcd.start')
-rwxr-xr-xetc/local.d/00-dhcpcd.start44
1 files changed, 44 insertions, 0 deletions
diff --git a/etc/local.d/00-dhcpcd.start b/etc/local.d/00-dhcpcd.start
new file mode 100755
index 0000000..65d8957
--- /dev/null
+++ b/etc/local.d/00-dhcpcd.start
@@ -0,0 +1,44 @@
+#!/bin/sh
+. /etc/local.d/vars.sh
+# Not actually starting dhcpcd here, just writing out the configuration
+# file based on what we have in vars
+#
+# This file also installs the `radvd.hook` to enable ipv6 router advertisements
+# on the lan interface.
+
+# Write out our dhcpcd conf, take note that I've specifically disabled ipv4
+# here. I could enable it, however to keep a static ipv4 address the same as
+# with a previous router it makes sense to have a DHCPv4 server not using a
+# duid. ( So, udhcpc is still used )
+cat > /etc/dhcpcd.conf <<EOF
+duid
+nodhcp
+noipv4
+noipv4ll
+dhcp6
+persistent
+vendorclassid
+option domain_name_servers, domain_name, domain_search
+option classless_static_routes
+option interface_mtu
+option host_name
+option rapid_commit
+require dhcp_server_identifier
+slaac private
+noipv6rs
+denyinterfaces $lan
+interface $wan
+ ipv6rs
+ ia_na 1
+ ia_pd 2 $lan/0
+EOF
+
+echo "Generated dhcpcd.conf:"
+
+cat /etc/dhcpcd.conf
+
+# Copy the dhcpcd hook for radvd into place
+cp /etc/local.d/radvd.hook \
+ /usr/lib/dhcpcd/dhcpcd-hooks/60-radvd.conf
+
+. /etc/local.d/vars_end.sh