Created
March 30, 2024 04:49
-
-
Save gbrayut/855377736c37c0d81a0015bd43907b59 to your computer and use it in GitHub Desktop.
Configure static ipv6 ULA address
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Also need to configure static route on UnifiOS: