Skript pro změnu DNS serverů v Mikrotiku: Porovnání verzí
Z Wiki UnArt Slavičín
Skočit na navigaciSkočit na vyhledávání
Bez shrnutí editace |
Bez shrnutí editace |
||
Řádek 14: | Řádek 14: | ||
# nakonec pro samotny Mikrotik | # nakonec pro samotny Mikrotik | ||
/ip dns set servers=$dnsServers | /ip dns set servers=$dnsServers | ||
# Autor: Michal Kliment | |||
# Datum: listopad 2011 | |||
# Popis: Skript nastavuje hodnoty DNS serveru na zadanou hodnotu | |||
# IP adresy DNS serveru, vice hodnot je nutno oddelit carkami | |||
:global dnsServers "10.143.126.9,10.143.128.1" | |||
:global primaryServer | |||
:global secondaryServer | |||
:global servers $dnsServers | |||
:if ([:find $servers ,] > 0) do={ | |||
:set primaryServer [:pick $servers 0 [:find $servers ,]] | |||
:set servers [:pick $servers ([:find $servers ,] +1) [:len $servers]] | |||
} else={ | |||
:set primaryServer $servers | |||
:set servers "" | |||
} | |||
:if ([:find $servers ,] > 0) do={ | |||
:set secondaryServer [:pick $servers 0 [:find $servers ,]] | |||
:set servers [:pick $servers ([:find $servers ,] +1) [:len $servers]] | |||
} else={ | |||
:set secondaryServer $servers | |||
:set servers "" | |||
} | |||
# nejdrive nastavime DNS u DHCP podsiti | |||
/ip dhcp-server network | |||
:foreach i in=[find] do={ | |||
set $i dns-server=$dnsServers | |||
} | |||
/ip dns set primary-dns=$primaryServer secondary-dns=$secondaryServer |
Verze z 24. 11. 2011, 11:40
# Autor: Michal Kliment # Datum: listopad 2011 # Popis: Skript nastavuje hodnoty DNS serveru na zadanou hodnotu # IP adresy DNS serveru, vice hodnot je nutno oddelit carkami :global dnsServers "10.143.126.9,10.143.128.1" # nejdrive nastavime DNS u DHCP podsiti /ip dhcp-server network :foreach i in=[find] do={ set $i dns-server=$dnsServers } # nakonec pro samotny Mikrotik /ip dns set servers=$dnsServers
# Autor: Michal Kliment # Datum: listopad 2011 # Popis: Skript nastavuje hodnoty DNS serveru na zadanou hodnotu # IP adresy DNS serveru, vice hodnot je nutno oddelit carkami :global dnsServers "10.143.126.9,10.143.128.1"
:global primaryServer :global secondaryServer
:global servers $dnsServers :if ([:find $servers ,] > 0) do={ :set primaryServer [:pick $servers 0 [:find $servers ,]] :set servers [:pick $servers ([:find $servers ,] +1) [:len $servers]] } else={ :set primaryServer $servers :set servers "" } :if ([:find $servers ,] > 0) do={ :set secondaryServer [:pick $servers 0 [:find $servers ,]] :set servers [:pick $servers ([:find $servers ,] +1) [:len $servers]] } else={ :set secondaryServer $servers :set servers "" } # nejdrive nastavime DNS u DHCP podsiti /ip dhcp-server network :foreach i in=[find] do={ set $i dns-server=$dnsServers } /ip dns set primary-dns=$primaryServer secondary-dns=$secondaryServer