aboutsummaryrefslogtreecommitdiff
path: root/etc/local.d/00-net.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-net.start
downloadalpine-home-router-1.0.tar.gz
alpine-home-router-1.0.tar.xz
Diffstat (limited to 'etc/local.d/00-net.start')
-rwxr-xr-xetc/local.d/00-net.start21
1 files changed, 21 insertions, 0 deletions
diff --git a/etc/local.d/00-net.start b/etc/local.d/00-net.start
new file mode 100755
index 0000000..9c28f09
--- /dev/null
+++ b/etc/local.d/00-net.start
@@ -0,0 +1,21 @@
+#!/bin/sh
+. /etc/local.d/vars.sh
+
+ip link set dev $wan address $wan_hwaddr
+ip link set up $wan
+udhcpc -b -i $wan
+
+# dhcpv6
+dhcpcd
+
+ip link set up $lan
+ip -4 addr add $lan_ip/$lan_mask_bits dev $lan
+
+# We are indeed, a router.
+sysctl -w net.ipv4.ip_forward=1
+# Even though we're a router, accept router advertisements anyway
+sysctl -w net.ipv6.conf.all.accept_ra=2
+# IP Forwarding, but for ipv6 as well
+sysctl -w net.ipv6.conf.all.forwarding=1
+
+. /etc/local.d/vars_end.sh