Community discussions

MikroTik App
 
2fast4youbr
Member Candidate
Member Candidate
Topic Author
Posts: 113
Joined: Mon Apr 15, 2013 10:39 pm

Script check DNS serve is alive

Sun May 12, 2013 4:24 pm

Guys, I am new in script of RouterOS. I would like to know if is possible to do um script .

Today I have one linux running my DNS server (bind9) on ip 192.168.1.2.

I would like to have a script to ping this server each minute, in case it down, I new to change the dns servers on my mikrotik (192.168.1.1), I would like to take out the DNS Servers of /ip dns and set the property /IP dhcp-client USE PEER DNS.

So this would work in case my dns server is down, correct ?

Is there another way to do this ? I 've tried to set up the 2nd and 3rd server as 8.8.8.8, 8.8.4.4, but when I unplug my linux server, mikrotik don't go to the 8.8.8.8....

As my linux server has squid too, this would like to use to fix the proxy in case its down, so I would have to DISABLE the rule in firewall that sends all the traffic on port 80 to the squid.

cheers
 
CelticComms
Forum Guru
Forum Guru
Posts: 1766
Joined: Wed May 02, 2012 5:48 am

Re: Script check DNS serve is alive

Sun May 12, 2013 4:58 pm

You can use Netwatch to monitor a host and run a script when it goes down and another script when it comes back up
Interlynx | Networking and Information Security Consultants & Trainers | Email: routerlynx@gmail.com
BGP | EIGRP | OSPF | MPLS | Firewall | VPN | IPsec | Multicast | QOS | IPv4/6 | STP | VLAN | PON | AE | M2M | and more!

 
2fast4youbr
Member Candidate
Member Candidate
Topic Author
Posts: 113
Joined: Mon Apr 15, 2013 10:39 pm

Re: Script check DNS serve is alive

Sun May 12, 2013 5:26 pm

Thanks man...never seen NetWatch, will google about it.

cheers
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 24493
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: Script check DNS serve is alive

Mon May 13, 2013 2:27 pm

No answer to your question? How to write posts
 
2fast4youbr
Member Candidate
Member Candidate
Topic Author
Posts: 113
Joined: Mon Apr 15, 2013 10:39 pm

Re: Script check DNS serve is alive

Mon May 13, 2013 2:51 pm

Where can I learn se routerOS scripting? Is there a wiki for that too?

Thanks
 
 
jo2jo
Forum Veteran
Forum Veteran
Posts: 971
Joined: Fri May 26, 2006 1:25 am

Re: Script check DNS serve is alive

Fri Aug 03, 2018 12:47 am

is there anyway to check a DNS request against a specific dns server? ( ie equivlent of linux: dig @192.168.1.117 -p53 netflix.com ) ?

im trying to script (or netwatch) a check to confrim that a specific DNS server is working (ie its resolving dns queries) , else change the DNS the mikrotik uses.

(a dns-crypt server, im only missing the part on how to do a DNS query against a specific dns server on the mt, if its even possible, i know how to script the rest).

thanks
EDIT 2- NICE!! looks like you can do this! put [resolve google.com server=192.168.5.2] allows you to specify the dns server used, EXACTLY what i was looking for. thanks!

EDIT; i do know about [:resolve smtp.gmail.com] (in scripts) however that will not do what i want as that uses the DNS server the MT is set to (ie in /ip dns ) , im hoping to be able to manually set which dns server my script uses to resolve from (as im trying to always test that a specific dns server is resolving dns requests , not just replying to pings) . tks
:beep :beep :beep

Who is online

Users browsing this forum: mikrotikuserfree, romihg and 71 guests