dns server

Function

The dns server command configures an IP address for a DNS server.

The undo dns server command deletes the IP address of a DNS server.

By default, DNS servers do not have IP addresses.

Format

dns server ip-address [ vpn-instance vpn-instance-name ]

undo dns server ip-address [ vpn-instance vpn-instance-name ]

Parameters

Parameter Description Value
ip-address

IP address of a DNS server.

The value is in dotted decimal notation.

vpn-instance vpn-instance-name

Specifies the VPN to be displayed.

The value is a string of 1 to 31 case-sensitive characters, spaces not supported. In addition, the VPN instance name must not be _public_. When double quotation marks are used around the string, spaces are allowed in the string.

Views

System view

Default Level

2: Configuration level

Task Name and Operations

Task Name Operations
dns write

Usage Guidelines

Usage Scenario

If you want to obtain the IP addresses of destination hosts through their host names (for example, when you perform the ping or tracert operation), you need to run the dns resolve command to enable dynamic DNS. After dynamic DNS is enabled, you must run the dns server command to specify the IP addresses of the DNS servers, so as to obtain the mappings between the domain names and IP addresses of destination hosts.

Precautions

When using the dns server command, note the following:

  • During dynamic domain name resolution, the DNS client sends query packets to DNS servers in the order in which the DNS servers are configured. If a DNS client does not receive any response within 5 seconds after sending a DNS request, the DNS client re-sends the DNS request. If the DNS client does not receive any response for three consecutive attempts, the DNS client sends the DNS request to the next DNS server.
  • The IP address of the DNS server cannot be configured as a multicast address.

Example

# Set the IP address of the DNS server in the VPN named vpn1 to 172.16.1.2.
<HUAWEI> system-view
[~HUAWEI] ip vpn-instance vpn1
[*HUAWEI-vpn-instance-vpn1] ipv4-family
[*HUAWEI-vpn-instance-vpn1-af-ipv4] quit
[*HUAWEI-vpn-instance-vpn1] quit
[*HUAWEI] dns server 172.16.1.2 vpn-instance vpn1
# Set the IP address of a DNS server to 172.16.1.1.
<HUAWEI> system-view
[~HUAWEI] dns server 172.16.1.1
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >