1# dns<a name="EN-US_TOPIC_0000001179965857"></a> 2 3- [Command Function](#section997513673713) 4- [Syntax](#section146015943711) 5- [Parameters](#section5732111163716) 6- [Usage](#section15642141417371) 7- [Example](#section1995841617370) 8- [Output](#section1114210258917) 9 10## Command Function<a name="section997513673713"></a> 11 12This command is used to query and set the IP address of a DNS server on a board. 13 14## Syntax<a name="section146015943711"></a> 15 16dns <_1-2_\> <_IP_\> 17 18dns _-a_ 19 20## Parameters<a name="section5732111163716"></a> 21 22**Table 1** Parameter description 23 24<a name="table1942mcpsimp"></a> 25<table><thead align="left"><tr id="row1948mcpsimp"><th class="cellrowborder" valign="top" width="20.79%" id="mcps1.2.4.1.1"><p id="p1950mcpsimp"><a name="p1950mcpsimp"></a><a name="p1950mcpsimp"></a><strong id="b95550757711755"><a name="b95550757711755"></a><a name="b95550757711755"></a>Parameter</strong></p> 26</th> 27<th class="cellrowborder" valign="top" width="52.480000000000004%" id="mcps1.2.4.1.2"><p id="p1952mcpsimp"><a name="p1952mcpsimp"></a><a name="p1952mcpsimp"></a><strong id="b19814795720"><a name="b19814795720"></a><a name="b19814795720"></a>Description</strong></p> 28</th> 29<th class="cellrowborder" valign="top" width="26.729999999999997%" id="mcps1.2.4.1.3"><p id="p1954mcpsimp"><a name="p1954mcpsimp"></a><a name="p1954mcpsimp"></a><strong id="b167665273911755"><a name="b167665273911755"></a><a name="b167665273911755"></a>Value Range</strong></p> 30</th> 31</tr> 32</thead> 33<tbody><tr id="row1955mcpsimp"><td class="cellrowborder" valign="top" width="20.79%" headers="mcps1.2.4.1.1 "><p id="p1957mcpsimp"><a name="p1957mcpsimp"></a><a name="p1957mcpsimp"></a><1-2></p> 34</td> 35<td class="cellrowborder" valign="top" width="52.480000000000004%" headers="mcps1.2.4.1.2 "><p id="p1959mcpsimp"><a name="p1959mcpsimp"></a><a name="p1959mcpsimp"></a>Specifies the DNS server to set the IP address.</p> 36</td> 37<td class="cellrowborder" valign="top" width="26.729999999999997%" headers="mcps1.2.4.1.3 "><p id="p1961mcpsimp"><a name="p1961mcpsimp"></a><a name="p1961mcpsimp"></a><strong id="b1954822719815"><a name="b1954822719815"></a><a name="b1954822719815"></a>1</strong> or <strong id="b88294281386"><a name="b88294281386"></a><a name="b88294281386"></a>2</strong></p> 38</td> 39</tr> 40<tr id="row1962mcpsimp"><td class="cellrowborder" valign="top" width="20.79%" headers="mcps1.2.4.1.1 "><p id="p1964mcpsimp"><a name="p1964mcpsimp"></a><a name="p1964mcpsimp"></a><IP></p> 41</td> 42<td class="cellrowborder" valign="top" width="52.480000000000004%" headers="mcps1.2.4.1.2 "><p id="p1966mcpsimp"><a name="p1966mcpsimp"></a><a name="p1966mcpsimp"></a>Specifies the IP address of the server.</p> 43</td> 44<td class="cellrowborder" valign="top" width="26.729999999999997%" headers="mcps1.2.4.1.3 "><p id="entry1967mcpsimpp0"><a name="entry1967mcpsimpp0"></a><a name="entry1967mcpsimpp0"></a>N/A</p> 45</td> 46</tr> 47<tr id="row1968mcpsimp"><td class="cellrowborder" valign="top" width="20.79%" headers="mcps1.2.4.1.1 "><p id="p1970mcpsimp"><a name="p1970mcpsimp"></a><a name="p1970mcpsimp"></a>-a</p> 48</td> 49<td class="cellrowborder" valign="top" width="52.480000000000004%" headers="mcps1.2.4.1.2 "><p id="p1972mcpsimp"><a name="p1972mcpsimp"></a><a name="p1972mcpsimp"></a>Displays the current settings.</p> 50</td> 51<td class="cellrowborder" valign="top" width="26.729999999999997%" headers="mcps1.2.4.1.3 "><p id="entry1973mcpsimpp0"><a name="entry1973mcpsimpp0"></a><a name="entry1973mcpsimpp0"></a>N/A</p> 52</td> 53</tr> 54</tbody> 55</table> 56 57## Usage<a name="section15642141417371"></a> 58 59None 60 61## Example<a name="section1995841617370"></a> 62 63Example: 64 651. Check the current DNS settings. 662. Set the IP address of the alternate DNS server. 673. Check the settings. 68 69## Output<a name="section1114210258917"></a> 70 711. Check the current DNS settings: 72 73 ``` 74 OHOS # dns -a 75 dns1: 192.168.1.10 76 dns2: 0.0.0.0 77 ``` 78 792. Set the IP address of the alternate DNS server: 80 81 ``` 82 OHOS # dns 2 192.168.1.2 83 ``` 84 853. Check the settings: 86 87 ``` 88 OHOS # dns -a 89 dns1: 192.168.1.10 90 dns2: 192.168.1.2 91 ``` 92 93 94