# sesuaikan bagian ini
:local dns 27.131.2x.x
:local addrlist dns_aktif
:local interface ether5.DNS
# buat rule tangkap service dns jika belum ada
:if ([:len [/ip firewall filter find comment=cek-dns]] = 0) do={
/ip firewall filter add action=add-src-to-address-list address-list=$addrlist address-list-timeout=10s chain=forward comment=cek-dns disabled=no in-interface=$interface protocol=udp src-address=$dns src-port=53
}
# buat rule redirect dns jika dns server mati
:if ([:len [/ip firewall nat find comment=redirect-dns]] = 0) do={
/ip firewall nat add action=dst-nat chain=dstnat comment=redirect-dns disabled=yes dst-address=$dns dst-port=53 protocol=udp to-addresses=208.67.220.220 to-ports=443
}
# sensor dns diaktifkan
:if ([:len [/ip firewall address-list find list=$addrlist address=$dns] ] = 0) do={
/ip firewall nat set [/ip firewall nat find comment=redirect-dns disabled=yes] disabled=no
} else {
/ip firewall nat set [/ip firewall nat find comment=redirect-dns disabled=no] disabled=yes
}
Semoga Bermanfaat.
No comments:
Post a Comment