Skip to content

Instantly share code, notes, and snippets.

@gbrayut
Created March 30, 2024 04:49
Show Gist options
  • Save gbrayut/855377736c37c0d81a0015bd43907b59 to your computer and use it in GitHub Desktop.
Save gbrayut/855377736c37c0d81a0015bd43907b59 to your computer and use it in GitHub Desktop.
Configure static ipv6 ULA address
# Create systemd unit
cat << EOF > /etc/systemd/system/theg2-ipv6-ula.service
[Unit]
Description=Add ipv6 static ULA
After=network-online.target
Requires=network-online.target
[Service]
Type=oneshot
ExecStart=/sbin/ip address add fd0b:dead:b0b1::123 dev wlan0
RemainAfterExit=true
[Install]
WantedBy=multi-user.target
EOF
# Enable service
systemctl daemon-reload
systemctl start theg2-ipv6-ula
systemctl start theg2-ipv6-ula
# Create systemd-networkd unit
cat << EOF > /etc/systemd/network/10-static-wlan0.network
[Match]
Name=wlan0
[Network]
Address=fd0b:dead:b0b1::123/64
EOF
# TODO: enable/test
systemctl daemon-reload
systemctl start theg2-ipv6-ula
systemctl start theg2-ipv6-ula
cat << EOF > /etc/network/if-up.d/theg2-ipv6-ula
#!/bin/sh
# Only configure IPv6 for the desired interface
if [ "$IFACE" != "eth0" ]; then # wlan0 or eth0 or enp1s0
exit 0
fi
ip -6 addr add fd0b:dead:b0b1::123 dev $IFACE
EOF
chmod +x /etc/network/if-up.d/theg2-ipv6-ula
# Test using:
IFACE=wlan0 /etc/network/if-up.d/theg2-ipv6-ula
@gbrayut
Copy link
Author

gbrayut commented Mar 30, 2024

Also need to configure static route on UnifiOS:

image

@gbrayut
Copy link
Author

gbrayut commented Mar 30, 2024

After adding to unifios network settings as manual ipv4 and ipv6 dns servers should show up in resolvectl or on older systems:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment