Saturday 7 September 2013

Configuring Conditional DNS forwarding on a Cisco router

For whatever reason, you may wish to use your Cisco router as a primary DNS server. If you're stuck in a situation where you need to send certain DNS domain names to different DNS servers then this post is for you!

Firstly we must set our default DNS servers:

ip name-server 203.50.2.71
ip name-server 139.130.4.4

Secondly, now we need to configure our different DNS servers as "views"

ip dns view default
 dns forwarder 203.50.2.71
 dns forwarder 139.130.4.4

ip dns view internal_dns
 dns forwarder 192.168.0.10
 dns forwarder 192.168.0.11

Now we match our DNS views into a "view-list"

ip dns view-list conditional
! give the internal_dns view a priority of 10 and bind it to name-group 1
 view internal_dns 10
  restrict name-group 1
! give the default view a highest priority
 view default 99

Define the domains you wish to forward internally by "name-list"

ip dns name-list 1 permit 10\.IN-ADDR
ip dns name-list 1 permit .*.LOCAL

Enable the DNS server to the view-group "conditional"

ip dns server view-group conditional

Lastly, enable the DNS server

ip dns server