Conditional Forwarding#

DoHzel Proxy includes a powerful feature for redirecting DNS traffic for specific domains to designated DNS servers. This feature supports both domain names and regex patterns.

  • Help Command: Introduced in version 2.1.0, you can get help on conditional forwarding with:

    dohzel-proxy forwarding --help
    

  • Check Conditional Forwarding Status: View the current conditional forwarding rules:

    dohzel-proxy forwarding list
    
    Example output:
    ---------------------------------------------------------------
    | ID     | Priority | Type   | Rule       | Destination       |
    ---------------------------------------------------------------
    | 71DE4D | 1        | domain | domain.lo  | (dns) 10.10.2.4   |
    | 438770 | 2        | regex  | google     | (dns) 10.10.2.3   |
    | 29859E | 4        | domain | google.com | (dns) 10.10.9.40  |
    ---------------------------------------------------------------
    

    • ID: Randomly generated identifier for the rule.
    • Priority: Execution order of the rule, with lower numbers having higher priority.
    • Type: Specifies whether the rule is based on a domain or regex.
    • Rule: The domain or regex pattern to match.
    • Destination: The DNS server to which matching queries are forwarded.

Note: If no rules match, the default operating mode is applied, which usually involves sending the query to Hafnova via DoH.

Note: Changes may need a proxy restart to take effect.

Create a Conditional Entry#

To redirect DNS traffic for a specific domain, such as a local domain domain.lo whose DNS server is an Active Directory at 10.10.2.4, use:

dohzel-proxy forwarding create domain mydomain.local 10.10.2.4 -p 1
The -p (or --priority) option assigns a priority of 4, with lower numbers indicating higher priority.

For regex-based conditions, use:

dohzel-proxy forwarding create regex google 10.10.2.3 -p 2
This rule will redirect any domain containing "google" to the 10.10.2.3 DNS server.

Modify an Entry#

To change the priority of an existing rule:

dohzel-proxy forwarding change 71DE4D -p 100
This command changes the priority of the rule with ID 71DE4D to 100.

Remove an Entry#

To delete a rule by its ID:

dohzel-proxy forwarding remove 71DE4D