Configuring DNS

Using the NX-API REST, you can enable DNS configuration that would be enabled by the following CLI commands:

ip domain-lookup <CR>
ip domain-name <default domain name> [use-vrf <vrf-name>] <CR>
ip domain-list [use-vrf <vrf-name>] <CR>
ip name-server [<IPv4|IPv6 address>] use-vrf <vrf-name> <CR>
ip host <name> <IPv4 address>
ipv6 host <IPv6 address>

For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference: http://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-command-reference-list.html


CLI Commands

“ip domain-list”, “ip domain-name”, and “ip name-server” are supported under non-default (i.e. user specified) VRF mode as well as VRF “default” mode. The other commands mentioned in this document are supported under default VRF only and the value must be “default” for them when specifying dns:Prof.name.

“default” VRF
ip domain-name <name>
ip domain-list <name>
ip name-server <addr>

non-default VRF
vrf context <vrf>
ip domain-name <name>
ip domain-list <name>
ip name-server <addr>

For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference: http://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-command-reference-list.html

Enabling DNS

Enabling DNS
POST http://<IP_Address>/api/mo/sys/dns.json
{
  "topSystem": {
    "children": [
      {
        "dnsEntity": {
          "attributes": {
            "adminSt": "enabled"
}}}]}}
{
    imdata": []
}
<System>
  <dns-items>
    <adminSt>enabled</adminSt>
  </dns-items>
</System>

Enables DNS-based address translation. This feature is enabled by default.


CLI Commands

The CLI commands and options listed below are the equivalent to the payload example displayed in the pane on the right.

ip domain-lookup

For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference: http://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-command-reference-list.html

See the NX-API DME Model Reference for detailed information about classes and attributes described in the payload: https://developer.cisco.com/site/nx-os/docs/nexus-model-reference/

For information about using the payloads, see the Cisco Nexus 9000 Series NX-OS Programmability Guide https://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-programming-reference-guides-list.html

Disabling DNS

Disabling DNS
POST http://<IP_Address>/api/mo/sys/dns.json
{
  "topSystem": {
    "children": [
      {
        "dnsEntity": {
          "attributes": {
            "adminSt": "disabled"
}}}]}}
{
    imdata": []
}
<System>
  <dns-items>
    <adminSt>disabled</adminSt>
  </dns-items>
</System>

Enables DNS-based address translation. This feature is enabled by default.


CLI Commands

The CLI commands and options listed below are the equivalent to the payload example displayed in the pane on the right.

no ip domain-lookup

For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference: http://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-command-reference-list.html

See the NX-API DME Model Reference for detailed information about classes and attributes described in the payload: https://developer.cisco.com/site/nx-os/docs/nexus-model-reference/

For information about using the payloads, see the Cisco Nexus 9000 Series NX-OS Programmability Guide https://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-programming-reference-guides-list.html

Defining the Default Domain Name

Defining the Default Domain Name
POST http://<IP_Address>/api/mo/sys/dns.json
{
"dnsEntity": {
  "children": [
    {
      "dnsProf": {
        "attributes": {
          "name": "default"
        },
        "children": [
          {
            "dnsDom": {
              "attributes": {
                "name": "newDom"
}}}]}}]}}
{
    imdata": []
}
<System>
  <dns-items>
    <prof-items>
      <Prof-list>
        <name>default</name>
        <dom-items>
          <name>newDom</name>
        </dom-items>
      </Prof-list>
    </prof-items>
  </dns-items>
</System>

Defines the default domain name that Cisco NX-OS uses to complete unqualified host names. You can optionally define a VRF that Cisco NX-OS uses to resolve this domain name if it cannot be resolved in the VRF that you configured this domain name under.

Cisco NX-OS appends the default domain name to any hostname that does not contain a complete domain name before starting a domain-name lookup.


CLI Commands

The CLI commands and options listed below are the equivalent to the payload example displayed in the pane on the right.

ip domain-name newDom

For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference: http://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-command-reference-list.html

See the NX-API DME Model Reference for detailed information about classes and attributes described in the payload: https://developer.cisco.com/site/nx-os/docs/nexus-model-reference/

For information about using the payloads, see the Cisco Nexus 9000 Series NX-OS Programmability Guide https://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-programming-reference-guides-list.html

Defining Additional Domain Names

Defining Additional Domain Names
POST http://<IP_Address>/api/mo/sys/dns.json
{
"dnsEntity": {
  "children": [
    {
      "dnsProf": {
        "attributes": {
          "name": "default"
        },
        "children": [
          {
            "dnsDomExt": {
              "attributes": {
                "name": "newList"
}}}]}}]}}
{
    imdata": []
}
<System>
  <dns-items>
    <prof-items>
      <Prof-list>
        <name>default</name>
        <domext-items>
          <DomExt-list>
            <name>newList</name>
          </DomExt-list>
        </domext-items>
      </Prof-list>
    </prof-items>
  </dns-items>
</System>

Defines additional domain names that Cisco NX-OS can use to complete unqualified hostnames. You can optionally define a VRF that Cisco NX-OS uses to resolve these domain names if they cannot be resolved in the VRF that you configured this domain name under.

Cisco NX-OS uses each entry in the domain list to append that domain name to any hostname that does not contain a complete domain name before starting a domain-name lookup. Cisco NX-OS continues this process for each entry in the domain list until it finds a match.


CLI Commands

The CLI commands and options listed below are the equivalent to the payload example displayed in the pane on the right.

ip domain-list newList

For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference: http://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-command-reference-list.html

See the NX-API DME Model Reference for detailed information about classes and attributes described in the payload: https://developer.cisco.com/site/nx-os/docs/nexus-model-reference/

For information about using the payloads, see the Cisco Nexus 9000 Series NX-OS Programmability Guide https://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-programming-reference-guides-list.html

Defining IPv4 Name Servers

Defining IPv4 Name Servers
POST http://<IP_Address>/api/mo/sys/dns.json
{
"dnsEntity": {
  "children": [
    {
      "dnsProf": {
        "attributes": {
          "name": "default"
        },
        "children": [
          {
            "dnsProvider": {
              "attributes": {
                "addr": "128.66.0.0"
}}}]}}]}}
{
    imdata": []
}
<System>
  <dns-items>
    <prof-items>
      <Prof-list>
        <name>default</name>
        <prov-items>
          <Provider-list>
            <addr>128.66.0.0</addr>
          </Provider-list>
        </prov-items>
      </Prof-list>
    </prof-items>
  </dns-items>
</System>

Defines up to six name servers. The address can be either an IPv4 address or an IPv6 address.

You can optionally define a VRF that Cisco NX-OS uses to reach this name server if it cannot be reached in the VRF that you configured this name server under.


CLI Commands

The CLI commands and options listed below are the equivalent to the payload example displayed in the pane on the right.

ip name-server 128.66.0.0

For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference: http://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-command-reference-list.html

See the NX-API DME Model Reference for detailed information about classes and attributes described in the payload: https://developer.cisco.com/site/nx-os/docs/nexus-model-reference/

For information about using the payloads, see the Cisco Nexus 9000 Series NX-OS Programmability Guide https://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-programming-reference-guides-list.html

Defining IPv6 Name Servers

Defining IPv6 Name Servers
POST http://<IP_Address>/api/mo/sys/dns.json
{
"dnsEntity": {
  "children": [
    {
      "dnsProf": {
        "attributes": {
          "name": "default"
        },
        "children": [
          {
            "dnsProvider": {
              "attributes": {
                "addr": "2001:db8::"
}}}]}}]}}
{
    imdata": []
}
<System>
  <dns-items>
    <prof-items>
      <Prof-list>
        <name>default</name>
        <prov-items>
          <Provider-list>
            <addr>2001:db8::</addr>
          </Provider-list>
        </prov-items>
      </Prof-list>
    </prof-items>
  </dns-items>
</System>

Defines up to six name servers. The address can be either an IPv4 address or an IPv6 address.

You can optionally define a VRF that Cisco NX-OS uses to reach this name server if it cannot be reached in the VRF that you configured this name server under.


CLI Commands

The CLI commands and options listed below are the equivalent to the payload example displayed in the pane on the right.

ip name-server 2001:DB8::0

For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference: http://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-command-reference-list.html

See the NX-API DME Model Reference for detailed information about classes and attributes described in the payload: https://developer.cisco.com/site/nx-os/docs/nexus-model-reference/

For information about using the payloads, see the Cisco Nexus 9000 Series NX-OS Programmability Guide https://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-programming-reference-guides-list.html

Defining Static IPv4 Hostname-to-Address Mappings

Defining Static IPv4 Hostname-to-Address Mappings
POST http://<IP_Address>/api/mo/sys/dns.json

{
"dnsEntity": {
  "children": [
    {
      "dnsProf": {
        "attributes": {
          "name": "default"
        },
        "children": [
          {
            "dnsHost": {
              "attributes": {
                "name": "test"
              },
              "children": [
                {
                  "dnsIpv4Host": {
                    "attributes": {
                      "addr": "128.66.0.0"
}}}]}}]}}]}}
{
    imdata": []
}
<System>
  <dns-items>
    <prof-items>
      <Prof-list>
        <name>default</name>
        <host-items>
          <Host-list>
            <name>test</name>
            <ipv4host-items>
              <addr>128.66.0.0</addr>
            </ipv4host-items>
          </Host-list>
        </host-items>
      </Prof-list>
    </prof-items>
  </dns-items>
</System>

Defines static hostname-to-address mappings in the hostname cache. The address can be either an IPv4 address or an IPv6 address.


CLI Commands

The CLI commands and options listed below are the equivalent to the payload example displayed in the pane on the right.

ip host test 128.66.0.0

For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference: http://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-command-reference-list.html

See the NX-API DME Model Reference for detailed information about classes and attributes described in the payload: https://developer.cisco.com/site/nx-os/docs/nexus-model-reference/

For information about using the payloads, see the Cisco Nexus 9000 Series NX-OS Programmability Guide https://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-programming-reference-guides-list.html

Defining IPv6 Static Hostname-to-Address Mappings

Defining IPv6 Static Hostname-to-Address Mappings
POST http://<IP_Address>/api/mo/sys/dns.json
{
"dnsEntity": {
  "children": [
    {
      "dnsProf": {
        "attributes": {
          "name": "default"
        },
        "children": [
          {
            "dnsHost": {
              "attributes": {
                "name": "test6"
              },
              "children": [
                {
                  "dnsIpv6Host": {
                    "attributes": {
                      "addr": "2001:db8::"
}}}]}}]}}]}}
{
    imdata": []
}
<System>
  <dns-items>
    <prof-items>
      <Prof-list>
        <name>default</name>
        <host-items>
          <Host-list>
            <name>test6</name>
            <ipv6host-items>
              <addr>2001:db8::</addr>
            </ipv6host-items>
          </Host-list>
        </host-items>
      </Prof-list>
    </prof-items>
  </dns-items>
</System>

Defines static hostname-to-address mappings in the hostname cache. The address can be either an IPv4 address or an IPv6 address.


CLI Commands

The CLI commands and options listed below are the equivalent to the payload example displayed in the pane on the right.

ipv6 host test6 2001:DB8::0

For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference: http://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-command-reference-list.html

See the NX-API DME Model Reference for detailed information about classes and attributes described in the payload: https://developer.cisco.com/site/nx-os/docs/nexus-model-reference/

For information about using the payloads, see the Cisco Nexus 9000 Series NX-OS Programmability Guide https://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-programming-reference-guides-list.html

Configuring a Name for the IPv4 Host

Configuring a Name for the IPv4 Host
POST http://<mgmt0_IP>/api/mo/sys/dns.json
{
  "dnsEntity": {
    "children": [
      {
        "dnsProf": {
          "attributes": {
            "name": "default"
          },
          "children": [
            {
              "dnsHost": {
                "attributes": {
                  "name": "Name_1"
                },
                "children": [
                  {
                    "dnsIpv4Host": {
                      "attributes": {
                        "addr": "1.2.3.4"
}}}]}}]}}]}}
{
    "imdata": []
}
<System>
  <dns-items>
    <prof-items>
      <Prof-list>
        <name>default</name>
        <host-items>
          <Host-list>
            <name>Name_1</name>
            <ipv4host-items>
              <addr>1.2.3.4</addr>
            </ipv4host-items>
          </Host-list>
        </host-items>
      </Prof-list>
    </prof-items>
  </dns-items>
</System>

Note: This example was added in Release 7.0(3)I7(3).


CLI Commands

The CLI commands are equivalent to the payload examples displayed in the pane on the right. Click the DME tab in the top-left corner of the right pane to view the JSON payload. Click the YANG tab to view the XML payload.

ip host Name_1 1.2.3.4

For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference: http://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-command-reference-list.html

See the NX-API DME Model Reference for detailed information about classes and attributes described in the payload: https://developer.cisco.com/media/dme/index.html

For information about using the payloads, see the Cisco Nexus 9000 Series NX-OS Programmability Guide https://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-programming-reference-guides-list.html

Deleting a Name for the IPv4 Host

Deleting a Name for the IPv4 Host
POST http://<mgmt0_IP>/api/mo/sys/dns.json
{
  "dnsEntity": {
    "children": [
      {
        "dnsProf": {
          "attributes": {
            "name": "default"
          },
          "children": [
            {
              "dnsHost": {
                "attributes": {
                  "name": "Name_1"
                },
                "children": [
                  {
                    "dnsIpv4Host": {
                      "attributes": {
                        "status": "deleted"
}}}]}}]}}]}}
{
    "imdata": []
}
<System>
  <dns-items>
    <prof-items>
      <Prof-list>
        <name>default</name>
        <host-items>
          <Host-list>
            <name>Name_1</name>
            <ipv4host-items xc:operation="delete">
            </ipv4host-items>
          </Host-list>
        </host-items>
      </Prof-list>
    </prof-items>
  </dns-items>
</System>

Note: This example was added in Release 7.0(3)I7(3).


CLI Commands

The CLI commands are equivalent to the payload examples displayed in the pane on the right. Click the DME tab in the top-left corner of the right pane to view the JSON payload. Click the YANG tab to view the XML payload.

no ip host Name_1 1.2.3.4

For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference: http://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-command-reference-list.html

See the NX-API DME Model Reference for detailed information about classes and attributes described in the payload: https://developer.cisco.com/media/dme/index.html

For information about using the payloads, see the Cisco Nexus 9000 Series NX-OS Programmability Guide https://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-programming-reference-guides-list.html

Configuring a Name for the IPv6 Host

Configuring a Name for the IPv6 Host
POST http://<mgmt0_IP>/api/mo/sys/dns.json
{
  "dnsEntity": {
    "children": [
      {
        "dnsProf": {
          "attributes": {
            "name": "default"
          },
          "children": [
            {
              "dnsHost": {
                "attributes": {
                  "name": "Name_1"
                },
                "children": [
                  {
                    "dnsIpv6Host": {
                      "attributes": {
                        "addr": "1:2::3:4"
}}}]}}]}}]}}
{
    "imdata": []
}
<System>
  <dns-items>
    <prof-items>
      <Prof-list>
        <name>default</name>
        <host-items>
          <Host-list>
            <name>Name_1</name>
            <ipv6host-items>
              <addr>1:2::3:4</addr>
            </ipv6host-items>
          </Host-list>
        </host-items>
      </Prof-list>
    </prof-items>
  </dns-items>
</System>

Note: This example was added in Release 7.0(3)I7(3).


CLI Commands

The CLI commands are equivalent to the payload examples displayed in the pane on the right. Click the DME tab in the top-left corner of the right pane to view the JSON payload. Click the YANG tab to view the XML payload.

ipv6 host Name_1 1:2::3:4

For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference: http://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-command-reference-list.html

See the NX-API DME Model Reference for detailed information about classes and attributes described in the payload: https://developer.cisco.com/media/dme/index.html

For information about using the payloads, see the Cisco Nexus 9000 Series NX-OS Programmability Guide https://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-programming-reference-guides-list.html

Deleting a Name for the IPv6 Host

Deleting a Name for the IPv6 Host
POST http://<mgmt0_IP>/api/mo/sys/dns.json
{
  "dnsEntity": {
    "children": [
      {
        "dnsProf": {
          "attributes": {
            "name": "default"
          },
          "children": [
            {
              "dnsHost": {
                "attributes": {
                  "name": "Name_1"
                },
                "children": [
                  {
                    "dnsIpv6Host": {
                      "attributes": {
                        "status": "deleted"
}}}]}}]}}]}}
{
    "imdata": []
}
<System>
  <dns-items>
    <prof-items>
      <Prof-list>
        <name>default</name>
        <host-items>
          <Host-list>
            <name>Name_1</name>
            <ipv6host-items xc:operation="delete">
            </ipv6host-items>
          </Host-list>
        </host-items>
      </Prof-list>
    </prof-items>
  </dns-items>
</System>

Note: This example was added in Release 7.0(3)I7(3).


CLI Commands

The CLI commands are equivalent to the payload examples displayed in the pane on the right. Click the DME tab in the top-left corner of the right pane to view the JSON payload. Click the YANG tab to view the XML payload.

no ipv6 host Name_1 1:2::3:4

For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference: http://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-command-reference-list.html

See the NX-API DME Model Reference for detailed information about classes and attributes described in the payload: https://developer.cisco.com/media/dme/index.html

For information about using the payloads, see the Cisco Nexus 9000 Series NX-OS Programmability Guide https://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-programming-reference-guides-list.html