ดาวไม่ได้ใช้งานดาวไม่ได้ใช้งานดาวไม่ได้ใช้งานดาวไม่ได้ใช้งานดาวไม่ได้ใช้งาน
 

############  Script Hostname in firewall  ##########
/ip firewall address-list add address=0.0.0.0 comment=www.mikrotik.com list=host_mikrotik
/ip firewall address-list add address=0.0.0.0 comment=forum.mikrotik.com list=host_mikrotik
/ip firewall address-list add address=0.0.0.0 comment=wiki.mikrotik.com list=host_mikrotik
/ip firewall filter add chain=ouput dst-address-list=host_mikrotik action=accept
/system script add \
   name=resolvehostnames policy=write,read \
   source="# define variables\r\
   \n:local list\r\
   \n:local comment\r\
   \n:local newip\r\
   \n:local oldip\r\
   \n\r\
   \n# Loop through each entry in the address list.\r\
   \n:foreach i in=[/ip firewall address-list find] do={\r\
   \n\r\
   \n# Get the first five characters of the list name\r\
   \n  :set list [:pick [/ip firewall address-list get \$i list] 0 5]\r\
   \n\r\
   \n# If they're 'host_', then we've got a match - process it\r\
   \n  :if (\$list = \"host_\") do={\r\
   \n\r\
   \n# Get the comment for this address list item (this is the host name to u\
   se)\r\
   \n    :set comment [/ip firewall address-list get \$i comment]\r\
   \n    :set oldip [/ip firewall address-list get \$i address]\r\
   \n\r\
   \n# Resolve it and set the address list entry accordingly.\r\
   \n    : if (\$newip != \$oldip) do={:set newip [:resolve \$comment]\r\
   \n    /ip firewall address-list set \$i address=\$newip}\r\
   \n    }\r\
   \n  }"
 /system scheduler add \
   comment="" disabled=no interval=1h name=updatehostnames on-event=resolvehostnames \
   start-date=jan/01/1970 start-time=00:00:00

###################  end  ##################