Community discussions

MikroTik App
 
planetcaravan
Member Candidate
Member Candidate
Topic Author
Posts: 267
Joined: Tue Aug 25, 2009 5:33 pm

Insert DNS with viariables

Wed Jun 13, 2012 5:07 pm

Hi,

I want to use a script which will add 3 DNS server to my RB with RouterOS 5.17.

This is working:
ip dns set servers=4.2.2.1,"4.2.2.2"
This one is not working:
:local DNS1
:local DNS2
:local DNS3

:set DNS1 "208.67.222.222"
:set DNS2 "4.2.2.1"
:set DNS3 "208.67.220.220"

/ip dns set servers=$DNS1,$DNS2,$DNS3
It returns an error at the first comma after $DNS1 in the last line: expected end of command

What's wrong?
You do not have the required permissions to view the files attached to this post.
 
User avatar
c0d3rSh3ll
Long time Member
Long time Member
Posts: 557
Joined: Mon Jul 25, 2011 9:42 pm
Location: [admin@Chile] >

Re: Insert DNS with viariables

Wed Jun 13, 2012 8:31 pm

{
:local DNS1
:local DNS2
:local DNS3
:set DNS1 "208.67.222.222"
:set DNS2 "4.2.2.1"
:set DNS3 "208.67.220.220"
/ip dns set servers="$DNS1,$DNS2,$DNS3"
}
 
planetcaravan
Member Candidate
Member Candidate
Topic Author
Posts: 267
Joined: Tue Aug 25, 2009 5:33 pm

Re: Insert DNS with viariables

Thu Jun 14, 2012 1:07 am

Thanks, it worked fine!

Who is online

Users browsing this forum: No registered users and 20 guests