Reach it by address but not by name: fix an A record, then give R1 a name server
Task
Build a small zone on a DNS server with an A record and a CNAME alias that points at it, query both with nslookup, then find a planted record fault from the one question the lesson says to ask first: does it work by address but not by name? Finally, read the IOS resolver's tell-tale broadcast message, and fix it so R1 resolves names itself.
Topology
Devices
| Device | Model | Role |
|---|---|---|
| R1 | ISR4331 | LAN router and DNS client |
| S1 | 2960-24TT | access switch, no configuration needed |
| PC1 | PC-PT | staff PC |
| SRV1 | Server-PT | DNS server for example.com |
| SRV2 | Server-PT | web server, www.example.com |
Links
| From | To |
|---|---|
| R1 G0/0/0 | S1 G0/1 |
| PC1 Fa0 | S1 Fa0/1 |
| SRV1 Fa0 | S1 Fa0/2 |
| SRV2 Fa0 | S1 Fa0/3 |
Addressing
| Device | Interface | Address | Default gateway |
|---|---|---|---|
| R1 | G0/0/0 | 192.168.20.1/24 | none |
| PC1 | NIC (DNS server 192.168.20.53) | 192.168.20.10/24 | 192.168.20.1 |
| SRV1 | NIC | 192.168.20.53/24 | 192.168.20.1 |
| SRV2 | NIC | 192.168.20.80/24 | 192.168.20.1 |
Steps
- Place the devices and cable them as the Topology lists. Use the automatic connection type (the lightning-bolt cable) for every link, so Packet Tracer picks straight-through or cross-over for you. Give PC1, SRV1 and SRV2 their addresses and gateway in Desktop > IP Configuration, and set the DNS Server field on all three to 192.168.20.53. Then configure R1:
Router> enable
Router# configure terminal
Router(config)# hostname R1
R1(config)# interface GigabitEthernet0/0/0
R1(config-if)# ip address 192.168.20.1 255.255.255.0
R1(config-if)# no shutdown
R1(config-if)# end
- Before any DNS exists, mistype a command on R1 and wait for the prompt to come back:
R1# shwo
Translating "shwo"...domain server (255.255.255.255)
% Unknown command or computer name, or unable to find computer address
IOS treated the unknown word as a host name and looked it up. The address in brackets is the clue the lesson describes: 255.255.255.255 means R1 has no ip name-server, so it broadcast the query and waited for an answer that never came. 3. Build the zone. On SRV1 open Services > DNS and set DNS Service to On. Add an A Record with Name www.example.com and Address 192.168.20.80. Then add a CNAME with Name intranet.example.com and Host Name www.example.com. The CNAME holds no address of its own: a client that asks for intranet.example.com is sent on to www, and the address comes from www's A record. 4. Query both names from PC1's Command Prompt, then open Desktop > Web Browser and browse to http://intranet.example.com: SRV2's default page loads.
C:\> nslookup www.example.com
C:\> nslookup intranet.example.com
Both answers end with the address 192.168.20.80, the first straight from the A record and the second through the alias. 5. Break it the way a server move often goes wrong. On SRV1, select the www.example.com A record, change its Address to 192.168.20.81 and click Save. On PC1, close and reopen the Web Browser, then browse to http://intranet.example.com again: the page no longer loads. Now ask the lesson's question:
C:\> ping 192.168.20.80
C:\> nslookup www.example.com
The ping by address gets replies, and nslookup returns 192.168.20.81, an address nobody holds. The link, the switch and the server are fine; the A record is wrong. Nothing about the CNAME is wrong either: as in the lesson's deleted-target case, the alias is only as good as the A record of the name it points to. 6. Fix the record: set the www.example.com A record's Address back to 192.168.20.80 and click Save. Close and reopen PC1's Web Browser, browse to http://intranet.example.com, and the page loads again. On a busy network the fix would take effect only as cached answers expire, which is what the TTL controls. 7. Give R1 a name server and a domain suffix, then use a name from R1. Packet Tracer accepts the older spelling ip domain-name, which the lesson writes as ip domain name:
R1# configure terminal
R1(config)# ip name-server 192.168.20.53
R1(config)# ip domain-name example.com
R1(config)# end
R1# ping www.example.com
The Translating message now names 192.168.20.53 instead of the broadcast address, and the pings go to 192.168.20.80. Mistype shwo once more: the message names 192.168.20.53 too, and the prompt returns much faster, because a server now answers. Many engineers add no ip domain-lookup on lab routers to stop the pause, but that would also stop ping www.example.com from working, so leave lookup on here.
Verify
C:\> nslookup intranet.example.com
Expected output, on PC1: an answer whose address line reads 192.168.20.80.
R1# show running-config | include name-server
Expected output: the line ip name-server 192.168.20.53.
R1# ping www.example.com
Expected output: Translating "www.example.com"...domain server (192.168.20.53), then five echoes sent to 192.168.20.80 and Success rate is 100 percent (5/5) (80 percent the first time, while ARP resolves, is also fine).
Save your work
On R1 run R1# copy running-config startup-config, then save the topology as ccna-lab20-dns.pkt (File > Save As).
Notes
This lab builds A and CNAME records, because those are the ones a simulated client can exercise end to end. The lesson's MX, NS, PTR and AAAA cases are read from its examples: an MX names a host with its own A record, an NS record sends resolvers to a zone's servers, and the PTR for 192.0.2.25 is the record named 25 in the reverse zone 2.0.192.in-addr.arpa, with the octets written backwards.
This is an independent study companion for the Cisco CCNA 200-301 v2.0 exam and is not produced by or endorsed by Cisco. Cisco, CCNA and IOS are trademarks of Cisco Systems, Inc.
This is an independent study companion for Cisco CCNA 200-301 and is not produced by or endorsed by CompTIA.