Community discussions

MikroTik App
 
Fulmo
just joined
Topic Author
Posts: 15
Joined: Mon Feb 22, 2021 12:32 pm

DNS exchange script

Mon Feb 22, 2021 12:46 pm

Hi!
First of all i want to change a server address to an another one, but i don't know how to start it. This is my first time to use script in any mikrotik devices, so probably I'm a newbie :D .
I have addresses in dnsServer like 8.8.8.8 and 4.4.4.4, just for the example, and i want to put the 10.10.10.10 to next to them, but maybe i did something wrong , becouse it isn't working
system script set test source={
:local dnsServer [/ip dns get servers]; 
:local append 10.10.10.10; 
:local newdns [:put ("$dnsServer" , "$append ")]; 
/ip dns set servers=$newdns ;}
if i run the script it got this message:
8.8.8.8;4.4.4.4;10.10.10.10
invalid value for argument server:
invalid value for argument ip
invalid value for argument ipv6


Sorry for my English!!!
 
Fulmo
just joined
Topic Author
Posts: 15
Joined: Mon Feb 22, 2021 12:32 pm

Re: DNS exchange script

Mon Feb 22, 2021 1:10 pm

Oh i solved this error... I wrote spaces...
So if anyone have an idea to change 8.8.8.8 to 10.10.10.10 please tell me :)
 
Fulmo
just joined
Topic Author
Posts: 15
Joined: Mon Feb 22, 2021 12:32 pm

Re: DNS exchange script  [SOLVED]

Mon Feb 22, 2021 2:51 pm

:D If someone got a problem like this, i describe what i got.
system script set test source={
:local dnsServer [/ip dns get servers];
:toarray $dnsServer ;
:set name=($dnsServer->[:find in=$dnsServer key=8.8.8.8]) value=6.6.6.6; 
/ip dns set servers=$dnsServer;

Who is online

Users browsing this forum: Maxfadeev699 and 19 guests