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 7: | Řádek 7: | ||
:global dnsServers "10.143.126.9,10.143.128.1" | :global dnsServers "10.143.126.9,10.143.128.1" | ||
# nejdrive | # nejdrive zrusime nastaveni DNS u DHCP podsiti | ||
/ip dhcp-server network | /ip dhcp-server network | ||
:foreach i in=[find] do={ | :foreach i in=[find] do={ | ||
set $i dns-server= | set $i dns-server="" | ||
} | } | ||
# | # nastavime DNS servery pro samotny Mikrotik | ||
/ip dns set servers=$dnsServers | /ip dns set servers=$dnsServers | ||
# povolime rekurzivni proxy DNS server | |||
/ip dns set allow-remote-requests=yes | |||
=== Pro verzi <= 4.5 === | === Pro verzi <= 4.5 === | ||
Řádek 46: | Řádek 49: | ||
} | } | ||
# nejdrive | # nejdrive zrusime nastaveni DNS u DHCP podsiti | ||
/ip dhcp-server network | /ip dhcp-server network | ||
:foreach i in=[find] do={ | :foreach i in=[find] do={ | ||
set $i dns-server="" | |||
} | } | ||
# nastavime DNS servery pro samotny Mikrotik | |||
/ip dns set primary-dns=$primaryServer secondary-dns=$secondaryServer | /ip dns set primary-dns=$primaryServer secondary-dns=$secondaryServer | ||
# povolime rekurzivni proxy DNS server | |||
/ip dns set allow-remote-requests=yes |
Aktuální verze z 11. 3. 2012, 03:29
Pro verzi > 4.5
# 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 zrusime nastaveni DNS u DHCP podsiti /ip dhcp-server network :foreach i in=[find] do={ set $i dns-server="" } # nastavime DNS servery pro samotny Mikrotik /ip dns set servers=$dnsServers # povolime rekurzivni proxy DNS server /ip dns set allow-remote-requests=yes
Pro verzi <= 4.5
# 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 zrusime nastaveni DNS u DHCP podsiti /ip dhcp-server network :foreach i in=[find] do={ set $i dns-server="" } # nastavime DNS servery pro samotny Mikrotik /ip dns set primary-dns=$primaryServer secondary-dns=$secondaryServer # povolime rekurzivni proxy DNS server /ip dns set allow-remote-requests=yes