# 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_
## Parameters
**Table 1** Parameter description
Parameter
|
Description
|
Value Range
|
<1-2>
|
Specifies the DNS server to set the IP address.
|
1 or 2
|
<IP>
|
Specifies 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 alternate DNS server.
3. Check the settings.
## Output
1. Check the current DNS settings:
```
OHOS # dns -a
dns1: 192.168.1.10
dns2: 0.0.0.0
```
2. Set the IP address of the alternate DNS server:
```
OHOS # dns 2 192.168.1.2
```
3. Check the settings:
```
OHOS # dns -a
dns1: 192.168.1.10
dns2: 192.168.1.2
```