08-15-2023
05:09 PM
- last edited on
08-16-2023
03:52 AM
by
rupeshah
hi,
I'm looking for a way how to set up a cisco asa to capture DNS queries to 8.8.8.8 and change/re-write them to another DNS server hosted in the "inside" using a private IP. we've got several remote sites breaking out on the ASA and by doing this we don't need to manually change each downstream user/client's DNS settings.
is there a feature or command to do this?
08-15-2023 11:38 PM
check below thread may help you and test and let us know : (you need to do tweak and other way around)
https://community.cisco.com/t5/network-security/asa-dns-redirect-forward/td-p/2225085
08-16-2023 05:24 AM
hi balaji,
thanks for the link! what do you mean by "tweak the other way around"?
can you give the complete config example that i could try?
08-15-2023 11:42 PM
- During a transition phase I would still advice to have clients get the correct and or new dns servers through DHCP , this may be faster (for the clients) and or you have more control over potential security issues ,
M.
08-16-2023 01:58 AM
You can do this using NAT or more accurately, twice NAT. Using this you will be able to translate the destination address.
08-16-2023 05:25 AM
hi marius,
yes, i read twice NAT before but haven't done it in a real world scenario (maybe this one does!).
can you give a config example for me to test it out?
08-16-2023 05:59 AM
Your NAT should look like this
object service obj_dns
service udp destination eq 53
nat (inside,outside) source static REAL_IP MAPPED_IP destination static MAPPED_IP REAL_IP service obj_dns obj_dns
08-16-2023 05:40 AM
hi,
i just got a new info that the "re-directed" DNS server is over the internet, therefore using a public IP, i.e. 123.1.2.3
should i write the twice NAT this way?
nat (outside,inside) source static 8.8.8.8 123.1.2.3 service udp domain domain
08-16-2023 06:41 AM
hi,
i found this link/blog and it's similar to what i'm trying to achieve.
https://traceroute.home.blog/2022/04/03/configuring-twice-nat/
just need someone to confirm if below config is correct?
basically, i'm using the "outside" interface for PAT the "inside" subnet then change/re-direct client's google DNS 8.8.8.8 to the "other" public DNS server 123.1.2.3.
object network INSIDE_SUBNET
host 192.168.1.0 255.255.255.0
object network GOOGLE_DNS
host 8.8.8.8
object network PUBLIC_DNS
host 123.1.2.3
nat (inside,outside) source static INSIDE_SUBNET interface destination static GOOGLE_DNS PUBLIC_DNS
08-16-2023 08:51 AM
that should work, you need to test it, any issue post the error here to help further.
08-16-2023 12:00 PM
That is pretty much what I suggested above. But I would still suggest specifying the destination port of udp/53 instead of NATing all ports as you are only trying to redirect DNS to the server, correct? Google DNS is quite a popular IP to test / troubleshoot with ping and traceroute.
Also, keep in mind that 8.8.4.4 is also a google DNS IP so you might want to add a NAT statement for this one also.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide