DNS

DNS 20 BADNAME vs 21 BADALG

Both DNS 20 (BADNAME) and 21 (BADALG) belong to the DNS Response Codes (RCODEs) category. 20 indicates that duplicate key name. The key name in a TKEY negotiation is already in use or conflicts with an existing key. Meanwhile, 21 means that algorithm not supported. The cryptographic algorithm specified in the TKEY or SIG record is not supported by the server.

Description

Duplicate key name. The key name in a TKEY negotiation is already in use or conflicts with an existing key.

When You See It

A TKEY key establishment failed because a key with the same name already exists on the server from a previous session that was not properly cleaned up.

How to Fix

Use a unique key name for each TKEY session (e.g., append a timestamp or random suffix). Delete stale keys on the server if they are no longer needed.

Description

Algorithm not supported. The cryptographic algorithm specified in the TKEY or SIG record is not supported by the server.

When You See It

Your TKEY negotiation or DNSSEC operation requested an algorithm (e.g., HMAC-SHA512) that the server has not been compiled with or configured to accept.

How to Fix

Use a mutually supported algorithm. HMAC-SHA256 is widely supported for TSIG; for DNSSEC, check the server's supported algorithm list with its documentation.

Key Differences

1.

DNS 20: Duplicate key name. The key name in a TKEY negotiation is already in use or conflicts with an existing key.

2.

DNS 21: Algorithm not supported. The cryptographic algorithm specified in the TKEY or SIG record is not supported by the server.

3.

You encounter 20 when a TKEY key establishment failed because a key with the same name already exists on the server from a previous session that was not properly cleaned up.

4.

You encounter 21 when your TKEY negotiation or DNSSEC operation requested an algorithm (e.g., HMAC-SHA512) that the server has not been compiled with or configured to accept.

When to Use Which

For 20 (BADNAME): Use a unique key name for each TKEY session (e.g., append a timestamp or random suffix). Delete stale keys on the server if they are no longer needed. For 21 (BADALG): Use a mutually supported algorithm. HMAC-SHA256 is widely supported for TSIG; for DNSSEC, check the server's supported algorithm list with its documentation.

Learn More