dns

Command Function

This command is used to query and set the IP address of a DNS server on a board.

Syntax

dns <1-2> <IP>

dns -a

Parameter Description

Table 1 Parameters

Parameter

Description

Value Range

<1-2>

Indicates the DNS server to set the IP address.

1 or 2

<IP>

Indicates the IP address of the server.

N/A

-a

Displays the current settings.

N/A

Usage

None

Example

Example:

  1. Check the current DNS settings.
  2. Set the IP address of the second DNS server.
  3. Verify the setting.

Output

  1. Checking the current DNS settings:

    OHOS # dns -a
    dns1: 192.168.1.10
    dns2: 0.0.0.0
    
  2. Setting the IP address of the second DNS server:

    OHOS # dns 2 192.168.1.2
    
  3. Verifying the setting:

    OHOS # dns -a
    dns1: 192.168.1.10
    dns2: 192.168.1.2