IBM Cloud Docs
Updating custom resolver forwarding rules

Updating custom resolver forwarding rules

You can update custom resolver forwarding rules in IBM Cloud® DNS Services by using the UI, CLI, or API.

Changing the Default rule might cause issues with DNS query resolution in VPCs that have virtual private endpoints, IKS clusters, ROKS clusters, or defined private DNS zones.

Updating custom resolver forwarding rules in the console

You can edit custom resolver forwarding rules from the custom resolver details page.

To edit a forwarding rule in the console, follow these steps:

  1. Click the Forwarding rules tab.

  2. Click the Actions menu Actions icon next to the rule you want to edit, then click Edit.

  3. In the panel that appears, change the match conditions, forwarding IP addresses, DNS views, or description.

  4. Click Save to commit your changes, or click Cancel to discard them.

    You cannot edit the rule type. If you require a different rule type, create a new rule.

Updating custom resolver forwarding rules from the CLI

To update a custom resolver forwarding rule using the CLI, run the following command:

ibmcloud dns custom-resolver-forwarding-rule-update RESOLVER_ID RULE_ID [--match HOSTNAME] [--dns-svcs IPs] [--description DESCRIPTION] [--add-view VIEW_PARAMETER --add-view VIEW_PARAMETER ...] [--update-view VIEW_PARAMETER --update-view VIEW_PARAMETER] [--reorder-view REORDER_VIEW_PARAMETER] [--remove-view VIEW_NAME --remove-view VIEW_NAME] [-i, --instance INSTANCE] [--output FORMAT]

Where:

  • RESOLVER_ID is the ID of custom resolver.
  • RULE_ID is the ID of custom resolver forwarding rule.
  • -d, --description is the descriptive text of the custom resolver forwarding rule.
  • -match is the matching zone or hostname.
  • --dns-svcs is the upstream DNS servers to be forwarded to.
  • --add-view is the value of the view parameters to be added in the forwarding rule.
  • --update-view is the value of the view parameters to be updated.
  • --reorder-view is the name of the views to be reordered.
  • --remove-view is the name of the view to be removed.
  • -i, --instance is the instance name or ID. If this is not set, the context instance specified by dns instance-target INSTANCE is used instead.
  • --output specifies output format. Currently, json is the only supported format.

Updating custom resolver forwarding rules with the API

To update a custom resolver forwarding rule using the API, follow these steps:

  1. Set up your API environment with the correct variables.

  2. Store the following values in variables to be used in the API command:

    • instance_id, which is the unique identifier of a service instance.
    • resolver_id, which is the unique identifier of a custom resolver.
    • rule_id, which is the unique identifier of a forwarding rule.
    • X-Correlation-ID, which is a string that uniquely identifies a request.
  3. When all variables are initiated, update your custom resolver forwarding rule:

    {
      "description": "forwarding rule",
      "match": "example.com",
      "forward_to": [
        "161.26.0.7"
      ],
      "views": [
        {
          "name": "view name",
          "description": "view description",
          "forward_to": [
            "161.26.0.7"
          ],
          "expression": "ipInRange(source.ip,'10.11.12.0/24')"
        }
      ]
    }