TechnitiumSoftware/DnsServer · error · NotSupportedException

DNS64 prefix can have only the following prefixes: 32, 40, 4

Error message

DNS64 prefix can have only the following prefixes: 32, 40, 48, 56, 64, or 96.

What it means

Thrown by the Dns64App Group constructor while parsing a 'dns64PrefixMap' entry. The DNS64/NAT64 prefix length must be one of the well-formed NAT64 prefix sizes (32, 40, 48, 56, 64, or 96 bits per RFC 6147/6052). Any other prefix length raises NotSupportedException.

Source

Thrown at Apps/Dns64App/App.cs:313

                    NetworkAddress network = NetworkAddress.Parse(strNetwork);
                    NetworkAddress dns64Prefix = null;

                    if (strDns64Prefix is not null)
                    {
                        dns64Prefix = NetworkAddress.Parse(strDns64Prefix);

                        switch (dns64Prefix.PrefixLength)
                        {
                            case 32:
                            case 40:
                            case 48:
                            case 56:
                            case 64:
                            case 96:
                                break;

                            default:
                                throw new NotSupportedException("DNS64 prefix can have only the following prefixes: 32, 40, 48, 56, 64, or 96.");
                        }
                    }

                    return new Tuple<NetworkAddress, NetworkAddress>(network, dns64Prefix);
                });

                _excludedIpv6 = jsonGroup.ReadArray("excludedIpv6", delegate (string strNetworkAddress)
                {
                    NetworkAddress networkAddress = NetworkAddress.Parse(strNetworkAddress);
                    if (networkAddress.Address.AddressFamily != AddressFamily.InterNetworkV6)
                        throw new InvalidOperationException("An IPv6 network address is expected for 'excludedIpv6' array.");

                    return networkAddress;
                });
            }

            #endregion

View on GitHub (pinned to d0484b6c1e)

Solutions

  1. Set the dns64Prefix to a valid NAT64 prefix length, most commonly '64:ff9b::/96' (the well-known prefix) or a /32, /40, /48, /56, /64 from your network's assigned prefix.
  2. Double-check the number after the slash matches one of the allowed values.
  3. Refer to RFC 6052 for the allowed NAT64 prefix sizes used by DNS64.

Example fix

// before (dnsApp.config)
"dns64PrefixMap": { "2001:db8::/64": "64:ff9b::/120" }
// after
"dns64PrefixMap": { "2001:db8::/64": "64:ff9b::/96" }
Defensive patterns

Strategy: validation

Validate before calling

static readonly HashSet<int> AllowedDns64PrefixLengths = new() { 32, 40, 48, 56, 64, 96 };
NetworkAddress dns64Prefix = NetworkAddress.Parse(strDns64Prefix);
if (!AllowedDns64PrefixLengths.Contains(dns64Prefix.PrefixLength))
    throw new FormatException($"DNS64 prefix length {dns64Prefix.PrefixLength} is invalid. Allowed: 32, 40, 48, 56, 64, 96 (RFC 6052).");

Type guard

static readonly HashSet<int> AllowedDns64PrefixLengths = new() { 32, 40, 48, 56, 64, 96 };
static bool IsValidDns64Prefix(NetworkAddress p) => AllowedDns64PrefixLengths.Contains(p.PrefixLength);

Prevention

When it happens

Trigger: Configuring a dns64Prefix whose CIDR length is not in {32,40,48,56,64,96}, e.g. '64:ff9b::/48' is fine but '2001:db8::/120' or '::/0' triggers the default branch.

Common situations: Using a non-standard or arithmetic-wrong prefix length; confusing the DNS64 prefix with a normal route prefix; typo in the slash length.

Related errors


AI-assisted analysis of TechnitiumSoftware/DnsServer@d0484b6c1e (2026-08-13). Data as JSON: /api/errors/1bca3a6b1807239a. Report an issue: GitHub.