This chapter covers
only IPv4 DNS configuration. For details about IPv6 DNS, refer to IPv6 Management
Operation.
Domain name system (DNS) is a mechanism
used for TCP/IP applications to provide domain name-to-IP address translation. With
DNS, you can use memorizable and meaningful domain names in some applications
and let the DNS server resolve it into correct IP addresses.
There are two types of DNS services, static
and dynamic. Each time the DNS server receives a name query, it checks its
static DNS database before looking up the dynamic DNS database. Reduction of
the searching time in the dynamic DNS database would increase efficiency. Some
frequently used addresses can be put in the static DNS database.
1.1.1 Static Domain Name Resolution
The static domain name resolution means manually
setting up mappings between domain names and IP addresses. IP addresses of the corresponding
domain names can be found in the static domain name resolution table for
applications, such as Telnet.
1.1.2 Dynamic Domain Name Resolution
I. Resolution procedure
Dynamic domain name resolution is
implemented by querying the DNS server. The resolution procedure is as follows:
1)
A user program sends a name query to the
resolver in the DNS client.
2)
The DNS resolver looks up the local domain name cache
for a match. If a match is found, it sends the corresponding IP address back.
If not, it sends the query to the DNS server.
3)
The DNS server looks up its DNS database for a match.
If no match is found, it sends a query to a higher-level DNS server. This
process continues until a result, success or failure, is returned.
4)
The DNS client performs the next operation
according to the result.

Figure 1-1 Dynamic domain name
resolution
Figure 1-1 shows the
relationship between user program, DNS client, and DNS server.
The resolver and cache comprise the DNS client.
The user program and DNS client run on the same device, while the DNS server and
the DNS client usually run on different devices.
Dynamic domain name resolution allows the
DNS client to store latest mappings between name and IP address in the dynamic domain
name cache of the DNS client. There is no need to send a request to the DNS server
for a repeated query request next time. The aged mappings are removed from the
cache after some time, and latest entries are required from the DNS server. The
DNS server decides how long a mapping is valid, and the DNS client gets the
information from DNS messages.
II. DNS suffixes
The DNS client normally holds a list of
suffixes which can be defined by users. It is used when the name to be resolved
is not complete. The resolver can supply the missing part (automatic domain
name addition). For example, a user can configure com as the suffix for
aabbcc.com. The user only needs to type aabbcc to get the IP address of
aabbcc.com. The resolver can add the suffix and delimiter before passing the
name to the DNS server.
l
If there is no dot in the domain name, such as
aabbcc, the resolver will consider this as a host name and add a DNS suffix
before processing. The original name such as aabbcc is used if all DNS lookups
fail.
l
If there is a dot in the domain name, such as
www.aabbcc or aabbcc., it indicates that no DNS suffix needs to be added and
the resolver will use this domain name to do DNS lookup first. If the lookup
fails, the resolver adds a DNS suffix for another lookup.
1.2 Configuring Domain Name Resolution
Table 1-1
Configure static domain name resolution
|
Operation
|
Command
|
Remarks
|
|
Enter system view
|
system-view
|
—
|
|
Configure a mapping between a host name
and an IP address
|
ip host
hostname ip-address
|
Required
No IP address is assigned to a host name
by default.
|
l
The IP address you assign to a host name last
time will overwrite the previous one if there is any.
l
You may create up to 50 static mappings between
domain names and IP addresses.
1.2.2 Configuring Dynamic Domain Name
Resolution
Table 1-2
Configure dynamic domain name resolution
|
Operation
|
Command
|
Remarks
|
|
Enter the system view
|
system-view
|
—
|
|
Enable dynamic domain name resolution
|
dns resolve
|
Required
Disabled by default
|
|
Configure an IP address for the DNS server
|
dns server ip-address
|
Required
No IP address is configured for the DNS
server by default.
|
|
Configure DNS suffixes
|
dns domain domain-name
|
Optional
No DNS suffix is configured by default
|
You may configure up to six DNS servers and ten DNS suffixes.
After the above configuration, you can execute
the display command and the nslookup type command in any view to display
the DNS configuration information and the DNS resolution result to verify the
configuration effect. You can execute the reset command in user view to
clear the information stored in the dynamic domain name resolution cache.
Table 1-3
Display and maintain DNS
|
Operation
|
Command…
|
Remarks
|
|
Display static DNS database
|
display ip host
|
Available in any view
|
|
Display the DNS server information
|
display dns server [ dynamic ]
|
|
Display the DNS suffixes
|
display dns domain [ dynamic ]
|
|
Display the information in the dynamic domain
name cache
|
display dns dynamic-host
|
|
Display the DNS resolution result
|
nslookup type { ptr ip-address | a domain-name
}
|
Available in any view
|
|
Clear the
information in the dynamic domain name cache
|
reset dns
dynamic-host
|
Available
in user view
|
I. Network requirements
The switch uses static domain name
resolution to access host 10.1.1.2 through domain name host.com.
II. Network diagram

Figure
1-2 Network diagram for static DNS configuration
III. Configuration procedure
# Configure a mapping between host name
host.com and IP address 10.1.1.2.
<Sysname> system-view
[Sysname] ip host host.com 10.1.1.2
# Execute the ping host.com command
to verify that the device can use static domain name resolution to get the IP
address 10.1.1.2 corresponding to host.com.
[Sysname] ping host.com
PING host.com (10.1.1.2): 56 data
bytes, press CTRL_C to break
Reply from 10.1.1.2: bytes=56
Sequence=1 ttl=127 time=3 ms
Reply from 10.1.1.2: bytes=56
Sequence=2 ttl=127 time=3 ms
Reply from 10.1.1.2: bytes=56
Sequence=3 ttl=127 time=2 ms
Reply from 10.1.1.2: bytes=56
Sequence=4 ttl=127 time=5 ms
Reply from 10.1.1.2: bytes=56
Sequence=5 ttl=127 time=3 ms
--- host.com ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 2/3/5 ms
I. Network requirements
As shown in Figure 1-3, the switch serving as a DNS client
uses dynamic domain name resolution to access the host at 3.1.1.1/16 through
its domain name host. The DNS server has the IP address 2.1.1.2/16. The
DNS suffix is com.
II. Network diagram

Figure 1-3 Network diagram for dynamic DNS configuration
III. Configuration procedure
Before doing the
following configuration, make sure that:
l
The routes between the DNS server, Switch, and
Host are reachable.
l
Necessary configurations are done on the devices.
For the IP addresses of the interfaces, see the figure above.
l
There is a mapping between domain name host
and IP address 3.1.1.1/16 on the DNS server.
l
The DNS server works normally.
# Enable dynamic domain name resolution.
<Sysname> system-view
[Sysname] dns resolve
# Configure the IP address 2.1.1.2 for the
DNS server.
[Sysname] dns server 2.1.1.2
# Configure com as the DNS suffix
[Sysname] dns domain com
Execute the ping host command on Switch
to verify that the communication between Switch and Host is normal and that the
corresponding IP address is 3.1.1.1.
[Sysname] ping host
Trying DNS server (2.1.1.2)
PING host.com (3.1.1.1): 56 data
bytes, press CTRL_C to break
Reply from 3.1.1.1: bytes=56
Sequence=1 ttl=125 time=4 ms
Reply from 3.1.1.1: bytes=56
Sequence=2 ttl=125 time=4 ms
Reply from 3.1.1.1: bytes=56
Sequence=3 ttl=125 time=4 ms
Reply from 3.1.1.1: bytes=56
Sequence=4 ttl=125 time=4 ms
Reply from 3.1.1.1: bytes=56
Sequence=5 ttl=125 time=5 ms
--- host.com ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 4/4/5 ms
1.5 Troubleshooting DNS
I. Symptom
After enabling the dynamic domain name
resolution, the user cannot get the correct IP address.
II. Solution
l
Use the display dns dynamic-host command
to check that the specified domain name is in the cache.
l
If there is no defined domain name, check that
dynamic domain name resolution is enabled and the DNS client can communicate
with the DNS server.
l
If the specified domain name exists in the cache
but the IP address is incorrect, check that the DNS client has the correct IP
address of the DNS server.
l
Check that the mapping between the domain name
and IP address is correct on the DNS server.