September 16, 2022

IPv6 UniFi USG radvd and dhcpv6-stateful issues

updated Fri Sep 16 16:52:54 EDT 2022

The goal is to configure the USG router in "dhcpv6-stateful" mode so a separate dhcpv6 server can be configured to handle ipv6 addresses on the network.

The perl script only generates stateful configuration for the eth1 interface. The eth0 interface remains slaac despite the /config/config.boot file showing dhcpv6-stateful on both interfaces. Apparently a bug in the perl script between the dhcpv6-pd stanzas and the radvd stanzas. If the whole interfaces ipv6 config is put in the config.gateway.json file it generates the correct radvd.conf file.

Files

  • /etc/radvd.conf
  • /opt/vyatta/sbin/vyatta_gen_radvd.pl
  • /srv/unifi/data/sites/default/config.gateway.json
  • /config/config.boot

#config.gateway.json
# for the dhcp6c.conf configuration

    "interfaces": {
        "ethernet": {
            "eth3": {

                "dhcpv6-pd": {
                    "no-dns": "''",
                    "pd": {
                        "0": {
                            "interface": {
                                "eth0": {
                                    "host-address": "::1",
                                    "service": "dhcpv6-stateful"
                                }
                            },
                            "prefix-length": "64"
                        },
                        "1": {
                            "interface": {
                                "eth1": {
                                    "host-address": "::1",
                                    "service": "dhcpv6-stateful"
                                }
                            },
                            "prefix-length": "64"
                        }
                    },
                    "rapid-commit": "enable"
                }
            }
#config.gateway.json
# for the radvd.conf configuration

{
	"interfaces": {
        "ethernet": {
            "eth0": {
               "ipv6": {
                    "dup-addr-detect-transmits": "1",
                    "router-advert": {
                        "cur-hop-limit": "64",
                        "default-preference": "medium",
                        "link-mtu": "0",
                        "max-interval": "600",
                        "managed-flag": "true",
                        "other-config-flag": "true",
                        "name-server": [
                            "2600:1700:1c60:df9f::5",
                            "2600:1700:1c60:df9f::6"
                        ],  
                        "prefix": {
                            "::/64": {
                                "autonomous-flag": "false",
                                "on-link-flag": "true",
                                "preferred-lifetime": "14400",
                                "valid-lifetime": "86400"
                            }   
                        },  
                        "radvd-options": [
                            "DNSSL example.com example2.com {};"
                        ],  
                        "reachable-time": "0",
                        "retrans-timer": "0",
                        "send-advert": "true"
                    }   
                }   

            },
            "eth1": {
               "ipv6": {
                    "dup-addr-detect-transmits": "1",
                    "router-advert": {
                        "cur-hop-limit": "64",
                        "default-preference": "medium",
                        "link-mtu": "0",
                        "max-interval": "600",
                        "managed-flag": "true",
                        "other-config-flag": "true",
                        "name-server": [
                            "2600:1700:1c60:df9f::5",
                            "2600:1700:1c60:df9f::6"
                        ],
                        "prefix": {
                            "::/64": {
                                "autonomous-flag": "false",
                                "on-link-flag": "true",
                                "preferred-lifetime": "14400",
                                "valid-lifetime": "86400"
                            }
                        },
                        "radvd-options": [
                            "DNSSL example.com example2.com {};"
                        ],
                        "reachable-time": "0",
                        "retrans-timer": "0",
                        "send-advert": "true"
                    }  
                }  
            }
        }
    }
}
    
# /etc/radvd.conf
# good configuration

interface eth0 {
#   This section was automatically generated by the Vyatta
#   configuration sub-system.  Do not edit it.
#
#   Generated by root on Fri Sep 16 15:04:11 2022
#
    IgnoreIfMissing on;
    AdvSendAdvert on;
    AdvOtherConfigFlag on;
    AdvDefaultLifetime 1800;
    AdvLinkMTU 0;
    AdvCurHopLimit 64;
    AdvReachableTime 0;
    MaxRtrAdvInterval 600;
    MinRtrAdvInterval 198;
    AdvDefaultPreference medium;
    AdvRetransTimer 0;
    AdvManagedFlag on;
    prefix ::/64 {
        AdvPreferredLifetime 14400;
        AdvAutonomous off;
        AdvOnLink on;
        AdvValidLifetime 86400;
    };
    RDNSS 2600:1700:1c60:df9f::5 2600:1700:1c60:df9f::6 {
    };
    DNSSL example.com example2.com {};
};
interface eth1 {
#   This section was automatically generated by the Vyatta
#   configuration sub-system.  Do not edit it.
#
#   Generated by root on Fri Sep 16 15:04:11 2022
#
    IgnoreIfMissing on;
    AdvSendAdvert on;
    AdvOtherConfigFlag on;
    AdvDefaultLifetime 1800;
    AdvLinkMTU 0;
    AdvCurHopLimit 64;
    AdvReachableTime 0;
    MaxRtrAdvInterval 600;
    MinRtrAdvInterval 198;
    AdvDefaultPreference medium;
    AdvRetransTimer 0;
    AdvManagedFlag on;
    prefix ::/64 {
        AdvPreferredLifetime 14400;
        AdvAutonomous off;
        AdvOnLink on;
        AdvValidLifetime 86400;
    };
    RDNSS 2600:1700:1c60:df9f::5 2600:1700:1c60:df9f::6 {
    };
    DNSSL example.com example2.com {};
};

No comments:

Post a Comment