nameserver

Syntax

nameserver <PRIMARY-IP-ADDR> [ <SECONDARY-IP-ADDR> ]

no nameserver <PRIMARY-IP-ADDR> [ <SECONDARY-IP-ADDR> ]

Description

Assigns a primary or secondary IPv4 or IPv6 DNS server to the management interface. IPv4 DNS servers can only be configured if a static IPv4 address was assigned to the management interface. IPv6 DNS servers can only be configured if a static IPv6 address was assigned to the management interface. The default gateway should be on the same network segment.

The no form of this command removes the DNS servers from the management interface.

Command context

config-if-mgmt

Parameters

<PRIMARY-IP-ADDR>

Specifies the IP address of the primary DNS server. Specify the address in IPv4 format (x.x.x.x), where x is a decimal number from 0 to 255, or IPv6 format (xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx), where x is a hexadecimal number from 0 to F.

When specifying an IPv4 address, you can remove leading zeros. For example, the address 192.169.005.100 becomes 192.168.5.100.

When specifying an IPv6 address, you can use two colons (::) to represent consecutive zeros (but only once), remove leading zeros, and collapse a hextet of four zeros to a single 0. For example, this address 2222:0000:3333:0000:0000:0000:4444:0055 becomes 2222:0:3333::4444:55.

<SECONDARY-IP-ADDR>

Specifies the IP address of the secondary DNS server. Specify the address in IPv4 format (x.x.x.x), where x is a decimal number from 0 to 255, or IPv6 format (xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx), where x is a hexadecimal number from 0 to F.

When specifying an IPv4 address, you can remove leading zeros. For example, the address 192.169.005.100 becomes 192.168.5.100.

When specifying an IPv6 address, you can use two colons (::) to represent consecutive zeros (but only once), remove leading zeros, and collapse a hextet of four zeros to a single 0. For example, this address 2222:0000:3333:0000:0000:0000:4444:0055 becomes 2222:0:3333::4444:55.

Authority

Administrators

Examples

Setting primary and secondary DNS servers with the IPv4 addresses of 198.168.5.1 and 198.168.5.2 :

switch(config)# interface mgmt
switch(config-if-mgmt)# nameserver 198.168.5.1 198.168.5.2

Setting primary and secondary DNS servers with the IPv6 addresses of 2001:DB8::1 and 2001:DB8::2:

switch(config)# interface mgmt
switch(config-if-mgmt)# nameserver 2001:DB8::1 2001:DB8::2