TechnitiumSoftware/DnsServer · error · InvalidOperationException

An IPv6 network address is expected for 'excludedIpv6' array

Error message

An IPv6 network address is expected for 'excludedIpv6' array.

What it means

Thrown by the Dns64App Group constructor while parsing the 'excludedIpv6' array. Each entry is parsed with NetworkAddress.Parse and then must be an IPv6 address (AddressFamily.InterNetworkV6); an IPv4 address or other value raises InvalidOperationException.

Source

Thrown at Apps/Dns64App/App.cs:324

                            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

            #region properties

            public string Name
            { get { return _name; } }

            public bool EnableDns64
            { get { return _enableDns64; } }

            public Dictionary<NetworkAddress, NetworkAddress> Dns64PrefixMap
            { get { return _dns64PrefixMap; } }

View on GitHub (pinned to d0484b6c1e)

Solutions

  1. Ensure every entry in the 'excludedIpv6' array is an IPv6 network address (e.g. '2001:db8::/32', '::1/128').
  2. Move any IPv4 exclusions out of 'excludedIpv6'; IPv4 clients are not subject to DNS64 anyway.
  3. Validate each entry's AddressFamily is InterNetworkV6 before saving.

Example fix

// before (dnsApp.config)
"excludedIpv6": [ "192.168.0.0/16", "2001:db8::/32" ]
// after
"excludedIpv6": [ "2001:db8::/32", "::1/128" ]
Defensive patterns

Strategy: type-guard

Validate before calling

foreach (string entry in excludedIpv6Array)
{
    NetworkAddress na = NetworkAddress.Parse(entry);
    if (na.Address.AddressFamily != System.Net.Sockets.AddressFamily.InterNetworkV6)
        throw new FormatException($"'excludedIpv6' entry '{entry}' is not IPv6. Only IPv6 networks belong here.");
}

Type guard

static bool IsIpv6Network(string entry)
{
    NetworkAddress na = NetworkAddress.Parse(entry);
    return na.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetworkV6;
}

Prevention

When it happens

Trigger: Adding an IPv4 address (e.g. '192.168.1.5' or '10.0.0.0/8') to the 'excludedIpv6' array, which is reserved for IPv6 networks to exclude from DNS64 synthesis.

Common situations: Reusing the networkGroupMap IPv4 subnets in excludedIpv6 by mistake; pasting a mix of v4/v6 addresses; misunderstanding the array as a general exclusion list.

Related errors


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