Cisco – How to statically configure DNS servers on a Cisco router when the WAN interface uses DHCP

ciscodhcpdomain-name-systemrouter

I have a Cisco router (model 887VA, IOS 15.4) used to connect a LAN to the Internet via ADSL. The WAN interface uses DHCP:

interface ATM0.1 point-to-point
 ip address dhcp

I need the router to use a statically-defined DNS server for name resolution:

ip name-server A.B.C.D

However, the router insists on using the DNS servers supplied by the ISP via DHCP:

Router#ping www.google.com
Translating "www.google.com"...domain server (<ISP DNS>) [OK]

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 173.194.116.208, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 44/45/48 ms

How can I tell the router to ignore the ISP-supplied DNS servers and only use the statically-configured one?

Best Answer

Found it.

As per this page, the command no ip dhcp client request dns-nameserver on a DHCP-enabled interface instructs the router to not request DNS information from the DHCP server when configuring that interface; after setting it on interface ATM0.1, the DNS configuration is still received from the DHCP server (it can be seen in the dhcp debug output), but it's ignored, and the router uses the statically-configured DNS server.

interface ATM0.1 point-to-point
 ip address dhcp
 no ip dhcp client request dns-nameserver