# dns - [Command Function](#section997513673713) - [Syntax](#section146015943711) - [Parameter Description](#section5732111163716) - [Usage](#section15642141417371) - [Example](#section1995841617370) - [Output](#section1114210258917) ## 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 ```