cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
15122
Views
10
Helpful
5
Replies

How to Create an Internal DNS/Host Table on Router?

Matthew Martin
Level 5
Level 5

Hello All,

Device: ISR4321/K9
IOS: Version 15.4(3)S4
IOS-XE: Version 03.13.04.S

I'm wondering if there is a way to create an internal Host table for internal DNS lookups on this ISR? I started looking around cisco.com and read something about VRF tables (*which I believe mean Virtual Routing and Forwarding?), but not sure if that's what I want...?

Basically, we want to be able to create a small list of Hostname to IP Address mappings for a few different destinations. And any other DNS queries that don't match what's in the Router's "local" table, should be sent to our internal DNS Server, which is currently configured in the DHCP Pools that are configured on the attached 2960X switch.

Since the DHCP Pools are on the 2960X Switch and not the ISR Router, I wasn't sure if this should be done on the ISR or the 2960? That is, if this is possible...

Any thoughts or suggestions would be greatly appreciated!

Thanks in Advance,
Matt

5 Replies 5

Dennis Mink
VIP Alumni
VIP Alumni

Have you tried configuring local DNS records:

)#ip host www.somedns.com  <ip address of that host>

please note, this doesnt turn the device into a DNS server, its more like a host file on a windows box.

Please rate if useful

Please remember to rate useful posts, by clicking on the stars below.

Hey Dennis, thanks for the reply!

Ok cool, I believe that's what we want to do. We still want our DNS Servers to handle DNS requests, we just want to be able to control where a couple of hosts will send you to. Do you know how exactly that command works from the client's perspective (*i.e. the PCs on the Network)?

For example, if the Router sees www.foobar.com coming in from a client's Web Browser, will it automatically send it to the host I define (*at the IP Address given) with that command?


Thanks Again,
Matt

UPDATE: I have a test network setup at my desk that mirrors what we have in our remote offices where I want to configure this Host to IP mappings. And I added the command:

ip host www.foobar.com 209.100.1.1

Then I took a Win7 laptop that I have connected to this equipment and tried to ping www.foobar.com and it comes back with the local / internal IP Address configured in out DNS Server... Is there more to this that I'm missing? I attempted to add this command on the ISR4321 Router as well as the 2960X switch, and I get the same results.

If I do the same exact ping, but from the ISR or the 2960X CLI, it actually pings the correct IP Address, just not from the clients...

Thanks,
Matt

Matthew Martin
Level 5
Level 5

Any other ideas?

Seems as though the clients aren't even looking at the "ip host <hostname> <ip_address>" commands. I've tried a few and they are still getting those specific ones from the DNS Server... Is VRF for VPN configurations only?

But, any suggestions would be greatly appreciated!

Thanks in Advance,
Matt

Matthew Martin
Level 5
Level 5

I believe I got it working... By running the following commands, connected clients to the 2960X switch will now get the correct IP defined in the host table. However, I had to include the ISR4321 in on this because the 2960X will not accept the "ip dns server" command to enable the Cisco switch to act as a DNS Server.

I'm actually curious why it won't accept this command, if anyone knows please feel free to reply...

ISR4321:

ISR-4321# conf t
ISR-4321(config)# ip dns server
ISR-4321(config)# ip domain lookup
ISR-4321(config)# ip host www.blahblahblah.com <ip_address>
ISR-4321(config)# end
ISR-4321# clear hosts *


2960X:

2960Xsw1# conf t
2960Xsw1(config)# ip dhcp pool DATA
2960Xsw1(dhcp-config)# dns-server  <ISR_ip-address>  <dns-server-1_ip-address>  <dns-server-2_ip-address>
2960Xsw1# clear hosts *


The 'clear hosts *' command probably wasn't necessary for the 2960, but I did it anyway just in case. Also, on the laptop connected to the switch I ran the command:

ipconfig /flushdns

to clear any cached hosts on the laptop. Then, I disabled and re-enabled the network card on the laptop to get the new list of DNS Servers and now I am getting the IP Address I defined on the ISR, instead of the IP defined on the actual DNS Servers. So it seems to be working..!


Thanks,
Matt