OpenDNS, strange behavior...

Hello!

I had wanted to use openDNS as my dns servers, while all of my lan clients use the mikrotik router ip for their requests (caching). Here’s the problem:

OpenDNS replies no matter what the hostname.

For instance, if I try to ping one client machine (behind a masquerade) from another, I get an incorrect response because it resolves the name from openDNS.

For instance,

behind the masquerade, machine “bill” tries to ping machine “jake,” which are both on the same subnet. The dhcp is giving both clients the mikrotik router address as the dns server. The reply from openDns’ intercept page comes back instead of the private internal address.

If any other DNS servers are used, this does not happen.

Any clues how to circumvent this?

If any other DNS servers are used, this does not happen.

Other public dns servers or other private dns servers?

If you have a limited number of machines, add static entries under /ip dns static.

Works for me.

You could also write a script that goes through the dhcp leases and extracts the active hostnames, adding them to the static dns table.

This is the default for OpenDNS.

However, there is a solution: add dhcp leases to static dns in the router:
http://wiki.mikrotik.com/wiki/Setting_static_DNS_record_for_each_DHCP_lease

I think the second script on that page may help, I’m going to test it later! THANK YOU!

The page says to run this in scheduler. Do I need to run this at an interval or just once in total? Would I have to re-run it in the event of a router reboot?

I’m running ROS 4.1, and there’s a “script” section… would that be a better place than scheduler?

Again, thank you.

The scheduler basically just runs scripts at a certain interval. To insure the dns entries are consistent with dhcp leases, I would schedule it for any interval (say 5mins). If you reboot, this script still gets run every 5 mins so you should be ok there.

First thing, add the script to RouterOS: System → Scripts
Then schedule the script: System → Scheduler (set OnEvent to the name of the added script above).

Also, you can find more about scripting here:
Manual:Scripting

Hope this helps.

Thank you much! This worked a treat!

I used the second script on the page as I have manual entries as well that I didn’t want disturbed. It uses the TTL difference to differentiate between the two types. Fantastic!

Glad I could help :slight_smile: