{"record":{"id":"1bca3a6b1807239a","repo":"TechnitiumSoftware/DnsServer","slug":"dns64-prefix-can-have-only-the-following-prefixes","errorCode":null,"errorMessage":"DNS64 prefix can have only the following prefixes: 32, 40, 48, 56, 64, or 96.","messagePattern":"DNS64 prefix can have only the following prefixes: 32, 40, 48, 56, 64, or 96\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"Apps/Dns64App/App.cs","lineNumber":313,"sourceCode":"                    NetworkAddress network = NetworkAddress.Parse(strNetwork);\n                    NetworkAddress dns64Prefix = null;\n\n                    if (strDns64Prefix is not null)\n                    {\n                        dns64Prefix = NetworkAddress.Parse(strDns64Prefix);\n\n                        switch (dns64Prefix.PrefixLength)\n                        {\n                            case 32:\n                            case 40:\n                            case 48:\n                            case 56:\n                            case 64:\n                            case 96:\n                                break;\n\n                            default:\n                                throw new NotSupportedException(\"DNS64 prefix can have only the following prefixes: 32, 40, 48, 56, 64, or 96.\");\n                        }\n                    }\n\n                    return new Tuple<NetworkAddress, NetworkAddress>(network, dns64Prefix);\n                });\n\n                _excludedIpv6 = jsonGroup.ReadArray(\"excludedIpv6\", delegate (string strNetworkAddress)\n                {\n                    NetworkAddress networkAddress = NetworkAddress.Parse(strNetworkAddress);\n                    if (networkAddress.Address.AddressFamily != AddressFamily.InterNetworkV6)\n                        throw new InvalidOperationException(\"An IPv6 network address is expected for 'excludedIpv6' array.\");\n\n                    return networkAddress;\n                });\n            }\n\n            #endregion\n","sourceCodeStart":295,"sourceCodeEnd":331,"githubUrl":"https://github.com/TechnitiumSoftware/DnsServer/blob/d0484b6c1e7439cdc53d67d81e9c876cda2ad756/Apps/Dns64App/App.cs#L295-L331","documentation":"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.","triggerScenarios":"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.","commonSituations":"Using a non-standard or arithmetic-wrong prefix length; confusing the DNS64 prefix with a normal route prefix; typo in the slash length.","solutions":["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.","Double-check the number after the slash matches one of the allowed values.","Refer to RFC 6052 for the allowed NAT64 prefix sizes used by DNS64."],"exampleFix":"// before (dnsApp.config)\n\"dns64PrefixMap\": { \"2001:db8::/64\": \"64:ff9b::/120\" }\n// after\n\"dns64PrefixMap\": { \"2001:db8::/64\": \"64:ff9b::/96\" }","handlingStrategy":"validation","validationCode":"static readonly HashSet<int> AllowedDns64PrefixLengths = new() { 32, 40, 48, 56, 64, 96 };\nNetworkAddress dns64Prefix = NetworkAddress.Parse(strDns64Prefix);\nif (!AllowedDns64PrefixLengths.Contains(dns64Prefix.PrefixLength))\n    throw new FormatException($\"DNS64 prefix length {dns64Prefix.PrefixLength} is invalid. Allowed: 32, 40, 48, 56, 64, 96 (RFC 6052).\");","typeGuard":"static readonly HashSet<int> AllowedDns64PrefixLengths = new() { 32, 40, 48, 56, 64, 96 };\nstatic bool IsValidDns64Prefix(NetworkAddress p) => AllowedDns64PrefixLengths.Contains(p.PrefixLength);","tryCatchPattern":null,"preventionTips":["Use a standard NAT64 prefix length; '64:ff9b::/96' is the well-known default.","Refer to RFC 6052 for allowed prefix sizes.","Double-check the slash-length number when editing."],"tags":["csharp","config","ipv6","dns64","nat64","network","technitium"],"backgroundTag":null,"analyzedSha":"d0484b6c1e7439cdc53d67d81e9c876cda2ad756","analyzedAt":"2026-08-13T22:57:35.508Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}