< Home

Example for Configuring the DNS Client

Networking Requirements

Compared with an IP address, the URL is easy to remember. Users want to access network servers using domain names. It is required that the DNS server can resolve a domain name after a user enters some fields of the domain name. For example, when a user attempts to access the host huawei.com, the user only needs to enter huawei. It is required that the DNS server can fast resolve common domain names.

Figure 1 Networking diagram for configuring the DNS client

Configuration Roadmap

The configuration roadmap is as follows:

  1. Configure static DNS entries on SwitchA to access HostB and HostC.

  2. Configure the dynamic DNS resolution on SwitchA to access the network server.

  3. Configure the domain name suffix on SwitchA to support a domain name suffix list.

  4. Configure OSPF on switches to ensure routes among all devices are reachable.

Procedure

  1. Configure SwitchA.

    # Configure an IP address for VLANIF101.

    <HUAWEI> system-view
    [HUAWEI] sysname SwitchA
    [SwitchA] vlan 101
    [SwitchA-vlan101] quit
    [SwitchA] interface gigabitethernet 0/0/1
    [SwitchA-GigabitEthernet0/0/1] port link-type access
    [SwitchA-GigabitEthernet0/0/1] port default vlan 101
    [SwitchA-GigabitEthernet0/0/1] quit
    [SwitchA] interface vlanif 101
    [SwitchA-Vlanif101] ip address 10.1.1.2 255.255.0.0
    [SwitchA-Vlanif101] quit

    # Configure OSPF.

    [SwitchA] ospf
    [SwitchA-ospf-1] area 0
    [SwitchA-ospf-1-area-0.0.0.0] network 10.1.0.0 0.0.255.255
    [SwitchA-ospf-1-area-0.0.0.0] quit
    [SwitchA-ospf-1] quit

    # Configure static DNS entries.

    [SwitchA] ip host hostB 10.4.1.1
    [SwitchA] ip host hostC 10.4.1.2

    # Enable DNS resolution.

    [SwitchA] dns resolve

    # Configure an IP address for the DNS server.

    [SwitchA] dns server 10.3.1.2

    # Set the domain name suffix to ".net".

    [SwitchA] dns domain net

    # Set the domain name suffix to ".com".

    [SwitchA] dns domain com
    [SwitchA] quit

    You need to configure OSPF on SwitchB and SwitchC to ensure reachable routes between them. For details about OSPF configurations on SwitchB and SwitchC, see the configuration files.

  2. Verify the configuration.

    # Run the ping hostB command on SwitchA. You can see that the ping operation succeeds and the destination IP address is 10.4.1.1.

    <SwitchA> ping hostB 
      PING hostB (10.4.1.1): 56  data bytes, press CTRL_C to break                   
        Reply from 10.4.1.1: bytes=56 Sequence=1 ttl=254 time=1 ms                   
        Reply from 10.4.1.1: bytes=56 Sequence=2 ttl=254 time=1 ms                   
        Reply from 10.4.1.1: bytes=56 Sequence=3 ttl=254 time=1 ms                   
        Reply from 10.4.1.1: bytes=56 Sequence=4 ttl=254 time=1 ms                   
        Reply from 10.4.1.1: bytes=56 Sequence=5 ttl=254 time=1 ms                   
                                                                                       --- hostB ping statistics ---                                                 
        5 packet(s) transmitted                                                     
        5 packet(s) received                                                        
        0.00% packet loss                                                           
        round-trip min/avg/max = 1/1/1 ms  

    # Run the ping huawei.com command on SwitchA. You can see that the ping operation succeeds and the destination IP address is 10.2.1.3.

    <SwitchA> ping huawei.com
      PING huawei.com (10.2.1.3): 56  data bytes, press CTRL_C to break
        Reply from 10.2.1.3: bytes=56 Sequence=1 ttl=254 time=6 ms
        Reply from 10.2.1.3: bytes=56 Sequence=2 ttl=254 time=4 ms
        Reply from 10.2.1.3: bytes=56 Sequence=3 ttl=254 time=4 ms
        Reply from 10.2.1.3: bytes=56 Sequence=4 ttl=254 time=4 ms
        Reply from 10.2.1.3: bytes=56 Sequence=5 ttl=254 time=4 ms
    
      --- huawei.com ping statistics ---
        5 packet(s) transmitted
        5 packet(s) received
        0.00% packet loss
        round-trip min/avg/max = 4/4/6 ms

    # Run the ping huawei command on SwitchA. You can see that the ping operation succeeds, the domain name changes to huawei.com, and the destination IP address is 10.2.1.3.

    <SwitchA> ping huawei
      PING huawei.com (10.2.1.3): 56  data bytes, press CTRL_C to break
        Reply from 10.2.1.3: bytes=56 Sequence=1 ttl=254 time=6 ms
        Reply from 10.2.1.3: bytes=56 Sequence=2 ttl=254 time=4 ms
        Reply from 10.2.1.3: bytes=56 Sequence=3 ttl=254 time=4 ms
        Reply from 10.2.1.3: bytes=56 Sequence=4 ttl=254 time=4 ms
        Reply from 10.2.1.3: bytes=56 Sequence=5 ttl=254 time=4 ms
    
      --- huawei.com ping statistics ---
        5 packet(s) transmitted
        5 packet(s) received
        0.00% packet loss
        round-trip min/avg/max = 4/4/6 ms

    Run the display ip host command on SwitchA. You can view mappings between host names and IP addresses in static DNS entries.

    <SwitchA> display ip host
    Host                 Age        Flags  Address
    hostB                0          static 10.4.1.1
    hostC                0          static 10.4.1.2 

    # Run the display dns dynamic-host command on SwitchA. You can view information about dynamic DNS entries saved in the cache.

    <SwitchA> display dns dynamic-host
    No  Domain-name         IpAddress      TTL    Alias
    1   huawei.com          10.2.1.3        114

Configuration File

SwitchA configuration file

#
sysname SwitchA
#
ip host hostB 10.4.1.1
ip host hostC 10.4.1.2
#
vlan batch 101
#
dns resolve
dns server 10.3.1.2
dns domain net
dns domain com
#
interface Vlanif101
 ip address 10.1.1.2 255.255.0.0
#
interface GigabitEthernet0/0/1
 port link-type access
 port default vlan 101
#
ospf 1
 area 0.0.0.0
  network 10.1.0.0 0.0.255.255
#
return

SwitchB configuration file

#
sysname SwitchB
#
vlan batch 100 to 101
#
interface Vlanif101
 ip address 10.1.1.1 255.255.0.0
#
interface Vlanif100
 ip address 10.2.1.1 255.255.0.0
#
interface GigabitEthernet0/0/1
 port link-type access
 port default vlan 100
#
interface GigabitEthernet0/0/2
 port link-type access
 port default vlan 101
#
interface LoopBack0
 ip address 10.4.1.1 255.255.255.255
#
ospf 1
 area 0.0.0.0
  network 10.1.0.0 0.0.255.255
  network 10.2.0.0 0.0.255.255
  network 10.4.1.1 0.0.0.0
#
return

SwitchC configuration file

#
sysname SwitchC
#
vlan batch 100 to 101
#
interface Vlanif100
 ip address 10.2.1.2 255.255.0.0
#
interface Vlanif101
 ip address 10.3.1.1 255.255.0.0
#
interface GigabitEthernet0/0/1
 port link-type access
 port default vlan 100
#
interface GigabitEthernet0/0/2
 port link-type access
 port default vlan 101
#
interface LoopBack0
 ip address 10.4.1.2 255.255.255.255
#
ospf 1
 area 0.0.0.0
  network 10.2.0.0 0.0.255.255
  network 10.3.0.0 0.0.255.255
  network 10.4.1.2 0.0.0.0
#
return
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >