ip dns host

Syntax

ip dns host <HOST-NAME> <IP-ADDR> [ vrf <VRF-NAME> ]
 
no ip dns host <HOST-NAME> <IP-ADDR> [ vrf <VRF-NAME> ] 

Description

Associates a static IP address with a hostname. The DNS client returns this IP address instead of querying a DNS server for an IP address for the hostname. Up to six hosts can be defined. If no VRF is defined, the default VRF is used.

The no form of this command removes a static IP address associated with a hostname.

Command context

config

Parameters

host <HOST-NAME>
Specifies the name of a host. Length: 1 to 256 characters.
<IP-ADDR>

Specifies an IP 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.

vrf <VRF-NAME>
Specifies the VRF to use. The VRF must be defined on the switch. If no VRF is specified, the default VRF is used.

Authority

Administrators

Examples

This example defines an IPv4 address of 3.3.3.3 for host1.

switch(config)# ip dns host host1 3.3.3.3

This example defines an IPv4 address of 3.3.3.4 for host4 and uses mainvrf.

switch(config)# ip dns host host4 3.3.3.4 vrf mainvrf

This example defines an IPv6 address of b::5 for host 1.

switch(config)# ip dns host host1 b::5

This example defines removes the entry for host 1 with address b::5.

switch(config)# no ip dns host host1 b::5