OPNsense
  • Home
  • Help
  • Search
  • Login
  • Register

  • OPNsense Forum »
  • English Forums »
  • 24.7 Production Series »
  • IPv6 Prefix change - help note
« previous next »
  • Print
Pages: [1]

Author Topic: IPv6 Prefix change - help note  (Read 99 times)

stanthewizzard

  • Jr. Member
  • **
  • Posts: 69
  • Karma: 1
    • View Profile
IPv6 Prefix change - help note
« on: November 13, 2024, 06:32:37 pm »
Hello to all

This topic can help poor soul like me.

My ISP changes the prefix of my ipv6 fiber.

Solution

dhcpv6
Range should be only the suffix

DHCPv6 Static Mappings for this interface.
also only suffix

But big issue with the dns servers (that are static in the settings and in my case those dns are from DHCPv6 Static Mapping)

Then
vi /usr/local/bin/update_dhcpv6_dns.sh

Code: [Select]
!/usr/bin/bash

ALIAS1="AD1"
ALIAS2="AD2"

IPV6_ADDR1=$(pfctl -t "$ALIAS1" -T show | grep ":" | head -n 1 | sed 's/^[[:space:]]*//')
IPV6_ADDR2=$(pfctl -t "$ALIAS2" -T show | grep ":" | head -n 1 | sed 's/^[[:space:]]*//')


if [ -z "$IPV6_ADDR1" ]; then
    echo "Error for ($ALIAS1)."
    exit 1
fi

if [ -z "$IPV6_ADDR2" ]; then
    echo "Error for  ($ALIAS2)."
    exit 1
fi



cp /conf/config.xml /conf/config.xml.bak


sed -i "" "/<dhcpdv6>/,/<\/dhcpdv6>/{
    s#<dnsserver>.*</dnsserver>#<dnsserver>$IPV6_ADDR1</dnsserver>#;

    /<dnsserver>/ {
        n
        s#<dnsserver>.*</dnsserver>#<dnsserver>$IPV6_ADDR2</dnsserver>#
    }
}" /conf/config.xml


grep -A 5 "<dhcpdv6>" /conf/config.xml

pluginctl -s dhcpd6 restart

ADDR2."

Then

vi /usr/local/opnsense/service/conf/actions.d/actions_dhcpv6update.conf

Code: [Select]
[wake]
command:/usr/local/bin/update_dhcpv6_dns.sh
type:script
description:DHCPv6 UPDT prefix DNS servers
message:UPDT DNS Servers DHCPv6

And last
add a cron from GUI

Problem is solved and shoudn't be wipped by opnsense updates

 ;)
Logged

  • Print
Pages: [1]
« previous next »
  • OPNsense Forum »
  • English Forums »
  • 24.7 Production Series »
  • IPv6 Prefix change - help note
 

OPNsense is an OSS project © Deciso B.V. 2015 - 2024 All rights reserved
  • SMF 2.0.19 | SMF © 2021, Simple Machines
    Privacy Policy
    | XHTML | RSS | WAP2