What's new

OpenDNS on a mikrotik wAP

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Montyzone

New Around Here
Greetings all

Thanks for looking into this post.

My setup is currently as such...

Fibre modem- >
mikrotik routerboard 2100 (Google DNS, static IP 192.168.0.1, DHCP enabled) ->
LAN ->
2 x mikrotik APs (auto DNS from gateway, static IP's 192.168.0.157 AND 192.168.0.179, Private connections, DHCP enabled 192.168.88.1) to be used as a public AP

I need to apply OpenDNS IP's to both wAPs only, so when public use it they are filtered off dodgy websites.
How can I do this without affecting the static Google DNS setup on the main mikrotik router (which LAN PCs are using its DNS servers from Google).

I just want to know the rational on how to do this.

Hope this makes sense?

Thanks

monty
 
by using a script
Code:
##############Script Settings##################

:local ODNUser ""
:local ODNPass ""
:local WANInter ""
:local odnshost ""
###############################################

:local IpCurrent [/ip address get [find interface=$WANInter] address];
:for i from=( [:len $IpCurrent] - 1) to=0 do={
  :if ( [:pick $IpCurrent $i] = "/") do={
    :local NewIP [:pick $IpCurrent 0 $i];
    #:if ([:resolve $NOIPDomain] != $NewIP) do={
      /tool fetch mode=https user=$ODNUser password=$ODNPass url="https://updates.opendns.com/nic/update\3Fhostname=$odnhost" keep-result=no
      :log info "OpenDNS updated - $NewIP"
     #}
   }
}

use the scheduler to run it regularly and insert your details into the script. This is a very simplified script that avoids using flash. It can be reduced even more though.

If there is no interface with public IP you can use mikrotik DDNS cloud to get your public IP in order to avoid using any flash storage as many script examples show.

It might be possible to use global variables to not use flash storage to store last IP and only update when IP changes but you would need the script to run often in order to compare.

You will need to run this on the rb2011 which is your main router. Your main router still uses google DNS but your APs must have their DNS set to openDNS server. Just set up your account in openDNS.

edit: You can have your main router to catch DNS requests and redirect them to openDNS instead, this will force your users to use openDNS regardless if they are hardcoded to use another DNS service. Since you are only filtering part of your clients than you need to do it where NAT is applied. If it is another ip segment that makes it much easier.
 
Last edited:

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top