Mikrotikã¹ã¯ãªããã®å€æ°ã«ã€ããŠå°ã調æ»ããè«çŒé¡ã®äžã§åºåãšåæåã調ã¹ãŸããã
ç§ã®æèŠã§ã¯ãèšäºãæžãã®ã«ãµãããããããã¯ã§ããããšãå€æããŸããã ããã§ã¯å§ããŸãããã
ManualïŒScriptingã¯ã¹ã¯ãªããå ã®å€æ°ã«ã€ããŠäœãæããŠãããŸããïŒ ãããŠãå€æ°ã«ã¯2ã€ã®ã¹ã³ãŒãããããããŒã«ã«ãšã°ããŒãã«ãã³ãã³ãã«ãã£ãŠå®£èšãããããšãæããŠãããŸã-
ïŒããŒã«ã«<åå> <å€>
ãããŠ
ïŒã°ããŒãã«<åå> <å€>
ã°ããŒãã«å€æ°ã«ããã«çŠç¹ãåœãŠãããšããå§ãããŸãããªããªãããããã¯ã芳枬å¯èœæ§ããåªããŠããããç 究ã容æã§ãããçµè«ã®ã»ãšãã©ã¯ç°¡åã«ããŒã«ã«ã«ç§»ããããã§ãã
æåã®ã°ããŒãã«å€æ°ã宣èšããåã«ãå€æ°å€ãŸãã¯æ¯èŒæŒç®åã®åŒæ°ãšããŠäœ¿çšã§ããçµã¿èŸŒã¿ããŒã¿åãšæåæ§æã®ããã€ãã®æ©èœãèŠãŠã¿ãŸãããã
ããã¥ã¢ã«ïŒã¹ã¯ãªããã£ã³ã°ã§ã¯ãçŽ12çš®é¡ã®ã¿ã€ããããããã®ãã¡ãå€æ°ãç解ããããã«éèŠãªã®ã¯ã»ãã®æ°çš®é¡ã ãšèããŠããŸãã ãããã£ãŠãæ瀺çããã³è«ççãªåïŒæ°å€num ãæååstrããã³é åarray ã 次ã«ãã¿ã€ãïŒå€æ°ã®å€ïŒ nilã«ã€ããŠèšåããŸããããã«ã€ããŠã¯ãäœãå²ãåœãŠãããŠããªãå Žåãããã©ã«ãã§å€æ°ããããæã€ããã«èšè¿°ãããŠããŸãã ä¿¡ããŠã
WinBoxã§ã³ãã³ãã³ã³ãœãŒã«ã䜿çšããå Žåãå¥ã®å¥åŠãªããŒã¯ãŒãnothingãããããšã«æ°ä»ãã§ãããã
[admin@MikroTik] > :global var0 [admin@MikroTik] > :put [:typeof $var0] nothing [admin@MikroTik] > /environment print var0=[:nothing]
ããŠã nilã¯ã©ãã§ããïŒ ãããã äœããªã ã
ç 究ãªã
äžè¬ã«ããããã®ç¹å¥ãªã¿ã€ããšå€ãæ±ãããã«ãäœç³»çãªã¢ãããŒããé©çšããåãã¿ã€ãã®ãªã¯ãšã¹ãã®çºè¡ãåæããŸããããœãŒã¹ããŒã¿ã®ã»ããã¯ç°ãªããŸãã ãããŠãæåã¯ãåæããŒã¿ãšããŠç°ãªããå¥åŠãªãå®æ°ãšåŒããããŸãã çµæã¯æ¬¡ã®ãããªè¡šã«ãªããŸãã
ãã | ããã¯äœã§ãã | <å€> | <å€2> | ïŒifïŒ<value> = <value2>ïŒdo = {ïŒput TRUE} else = {ïŒput FALSE} | ïŒput [ïŒtypeof <value>] | ïŒput [ïŒtypeof [ <value> ] ] | ïŒput [ïŒlen <å€>] | ïŒput [ïŒlen [ <å€> ] ] |
---|---|---|---|---|---|---|---|---|
1 | ã³ãã³ãã©ãããŒã«ã¯äœããªã | [] / [ïŒãªã] /ãŸãã¯[ïŒ] | [] | TRUE | ãªã | ãªã | 0 | 0 |
2 | ç©ºè¡ | ãã | "" / {} | TRUE | str | æåŸ ãããã³ãã³ãå | 0 | 0 |
3 | åŒã®äžã«ã¯äœããªã | ïŒïŒãªãïŒ/ãŸãã¯ããã§ãã£ãŠãïŒ:) | [] / "" / {} | åœ | äœããªã | ãªã | 0 | 0 |
4 | äœããªãé å | {ïŒãªã} / {ïŒ} | {} / "" | TRUE | é å | ãªã | 1 | 1 |
5 | é åèŠçŽ ãªã | ïŒ{ïŒãªã}-> 0ïŒ | [] / "" / {} | åœ | äœããªã | ãªã | 0 | 0 |
ããã§ã¯ãåŒãšã³ãã³ãã®ããŸããŸãªå®æ°ãå®æ°ã«å¯ŸããŠæ¯èŒããçµæã瀺ããŸãã å®æ°ã®ããããã£ãç解ãããšãæ¯èŒæŒç®åã®å³åŽãèšè¿°ãããšãã«åœ¹ç«ã¡ãŸãã
ããŒãã«ãã£ãŒã«ããç ç²ã«ããŠã Mikrotikã¹ã¯ãªããèšèªã§ã¯ãè§ãã£ãã¯ã³ãã³ãã®çµæãäžè¬åŒã«åã蟌ãŸããŠããããšã瀺ããŠãããããäžè¬çãªæå³ã§ã¯ãvalueïŒ= [Value]ãããã¯éèŠã§ãã
è¡ããšã«ã³ã¡ã³ãããŸãã
1è¡ç®ïŒ å€ãã£ãŒã«ããèšè¿°ããããã®ãã¹ãŠã®ãªãã·ã§ã³ã¯å矩ã§ãïŒ å°æ¥çã«ã¯ãç°¡æœãª[]ã䜿çšããããšããå§ãããŸãã ç¹°ãè¿ããŸãããè§æ¬åŒ§ã¯ãã³ãã³ãã®çµæãå ±éã®åŒã«åã蟌ãããšã瀺ããŸãã ã芧ã®ãšãããããã¯ã nilãçŽç²ãªåœ¢åŒã§ã¯ãªãã nilãšæ£ç¢ºã«çããè§æ¬åŒ§å ã®ç©ºã®ã³ãã³ãã®çµæãšããŠãçæãããæ¹æ³ã®1ã€ã§ãã
2è¡ç®ïŒ
ããã§ã¯ãã¹ãŠãç°¡åã§ãã 空ã®è¡ã¯æããã§ãã ããããŒãããé åã«çãããªãããšãå€æããå¯äžã®ç¬éã§ãããç§ã¯ããã«ç¹å¥ãªæ³šæãæããªãããšãææ¡ããŸãã ãããŠãè§æ¬åŒ§å ã®ã³ãã³ããšããŠç©ºã®è¡ã䜿çšããããšã¯ã§ããŸãããããã¯ç«¯æ«ãããŒãã«ã®å ã®ããŒã¿ã®æ§æã飲ã¿èŸŒãŸãªãã£ãå¯äžã®å Žæã§ãããè«ççã§ãã
3è¡ç®ïŒ
æ¬åŒ§ã¯å éšã«åŒãæã¡ãŸãããŸããå éšã«äœãå ¥ããããšã¯ã§ããŸãã ããŸãããã®ãããªåŒããã®çµæãäœããªããªããå®éã«ã¯ã»ãšãã©çŽç²ãªäœããããŸãã ã åŒã®çµæã®åïŒïŒnoneïŒã¯äœãäžãã ãã³ãã³ããã©ã±ãã[]ããã®ã©ãããŒã®åã¯nilãäžããŸãã1è¡ç®ãšåæ§ã«ãäžè¬ã«ãæžãããå 容ãåç解ããåŸããããæšæž¬ã§ããããšã«æ°ä»ããŸããã ïŒïŒ ãæå³ã®ãªãæåã®ã»ããã®äžã«äœã§ãå ¥ããããšãã§ããŸããäž»ãªããšã¯ãçµæïŒ...ïŒãäœãäžããªãããšã§ãã
è¡4ïŒ
äœãå«ãŸããŠããªãé åã«ã¯ãå®éã«ã¯1ã€ã®èŠçŽ ãå«ãŸããŠããŸãã äºæ³ãããããã«ãåã¯é åã§ãããã³ãã³ãã©ãããŒã®çµæã®åãnilãè¿ããŸãã
è¡5ïŒ
äœããªããšããããé åã®èŠçŽ ã«ãã©ãçããšã3è¡ç®ã§åºåã®å®å šãªé¡äŒŒæ§ãèŠãããšãã§ããŸããäžè¬ã«ããã®ãããªèŠçŽ ãçŽç²ãªãã®ã§ã¯ãããŸãã ã
ãã®å¥åŠãªé è³ããã©ã®ãããªäžè¬çãªçµè«ãåŒãåºãããšãã§ããŸããã å®éã«ã¯äœãååšãããæäœããããšãã§ãããŸããªåŒã§è¿ãããšãã§ããŸããã []ã®ã³ãã³ãã¯äœãè¿ãã ã nilã®ã¿ãè¿ããŸãã å¥ã®ããéèŠãªçµè«ã¯ãå€ã®é·ããŸãã¯é åå ã®èŠçŽ ã®æ°ã®æŒç®åïŒlenã¯éåžžã«å®å®ããŠåäœããäºæž¬å¯èœãªçµæãââçæãããšããããšã§ãããããã£ãŠãåŒãã³ãã³ãã«ãã£ãŠè¿ãããå€ã確èªããå¿ èŠãããå Žåãã¹ã¯ãªããã§ã®äœ¿çšããå§ãããŸãã ãããŠããã®[] = [ïŒnothing] = nilã§ãã
ãã®è¡šã¯ãMikrotikèšèªã®ããŸããŸãªã³ãã³ããšåŒãè¿ãããšã®ã§ããã¢ã€ãã¢ã瀺ããŠããŸãã
å¯å€å®£èšã®èª¿æ»
次ã«ãããå®çšçãªå€æ°å®£èšã«ç§»ããŸãããã
ãã | ããã¯äœã§ãã | çºè¡š | <val> | <val2> | ïŒput <val> | ïŒifïŒ<val> = <val2>ïŒdo = {ïŒput TRUE} else = {ïŒput FALSE} | ïŒput [ïŒtypeof <val>] | ïŒput [ïŒtypeof [ <val> ] ] | ïŒput [ïŒlen <val>]ããã¯åãã§ãïŒput [ïŒlen [ <val> ] ] | /ç°å¢å°å· |
---|---|---|---|---|---|---|---|---|---|---|
1 | å²ãåœãŠãªã | ïŒã°ããŒãã«var1 | $ var1 | [] /ïŒ:) | åœ/ç | äœããªã | ãªã | 0 | var1 = [ïŒãªã] | |
2 | å€æ°ã®å²ãåœãŠ | ïŒã°ããŒãã«var2ïŒïŒãªãïŒ | $ var2 | ïŒ:) | TRUE | äœããªã | ãªã | 0 | - | |
3 | å²ãåœãŠãªã | ïŒã°ããŒãã«var3 [] | $ var3 | [] | TRUE | ãªã | ãªã | 0 | var3 = [] | |
4 | 空çœè¡ã®å²ãåœãŠ | ïŒã°ããŒãã«var4 "" | $ var4 | "" / {} | TRUE / TRUE | str | str | 0 | var4 = "" | |
5ïŒ3ïŒ | å¥åŠãªnil ãã¢ããã°3 | ïŒã°ããŒãã«var5 [{}] | $ var5 | [{}] / [] | TRUE / TRUE | ãªã | ãªã | 0 | var5 = [] | |
6 | äœããªãé å | ïŒã°ããŒãã«var6 {ïŒ} | $ var6 | "" / {""} / {} | TRUE / TRUE / TRUE | é å | é å | 1 | var6 = {[ïŒãªã]} | |
7ïŒ6ã8ïŒ | 空ã®æååããã®é å | ïŒã°ããŒãã«var7 {""} | $ var7 | "" / {""} / {} | TRUE / TRUE / TRUE | é å | é å | 1 | var7 = {""} | |
8ïŒ6ã7ïŒ | nilã®é å | ïŒã°ããŒãã«var8 {[]} | $ var8 | "" / {""} / {} | TRUE / TRUE / TRUE | é å | é å | 1 | var8 = {[]} | |
ãã | ããã¯äœã§ãã | çºè¡š | <val> | <val2> | ïŒput <val> | ïŒifïŒ<val> = <val2>ïŒdo = {ïŒput TRUE} else = {ïŒput FALSE} | ïŒput [ïŒtypeof <val>] | ïŒput [ïŒtypeof [ <val> ] ] | ïŒput [ïŒlen <val>]ããã¯åãã§ãïŒput [ïŒlen [ <val> ] ] | /ç°å¢å°å· |
9 | æ¡çª | ïŒã°ããŒãã«var9 123 | $ var9 | n / aã | 123 | n / a | num | num | 3 | var9 = 123 |
10 | è¡ã®å²ãåœãŠ | ïŒã°ããŒãã«var10 "987" | $ var10 | n / aã | 987 | n / a | str | str | 3 | var10 = "987" |
11 | 1ã€ã®æ°å€ã®é å | ïŒã°ããŒãã«var11 {555} /ïŒã°ããŒãã«var11 {555;} | $ var11 | n / aã | 555 | n / a | é å | é å | 1 | var11 = {555} |
12 | ç°ãªãèŠçŽ ã®é å | ïŒã°ããŒãã«var12 {33; "test123"} | $ var12 | n / aã | 33; test123 | n / a | é å | é å | 2 | var12 = {33; ãtest123ã} |
13 | é åèŠçŽ | -//- | ïŒ$ var12-> 0ïŒ | n / aã | 33 | n / a | num | num | 2 | -//- |
14 | é åèŠçŽ | -//- | ïŒ$ var12-> 1ïŒ | n / aã | test123 | n / a | str | str | 7 | -//- |
15 | äœãèŠçŽ ããªãé å | ïŒã°ããŒãã«var13 {33;ïŒ:)} | $ var13 | n / aã | 33; | n / a | é å | é å | 2 | var13 = {33; [ïŒãªã]} |
16 | é åèŠçŽ | -//- | ïŒ$ var13-> 0ïŒ | n / aã | 33 | n / a | num | num | 2 | -//- |
17 | é åèŠçŽ | -//- | ïŒ$ var13-> 1ïŒ | n / aã | n / a | äœããªã | ãªã | 0 | -//- | |
18 | nilèŠçŽ ãæã€é å | ïŒã°ããŒãã«var14 {1012; []} | $ var14 | n / aã | 1012; | n / a | é å | é å | 2 | var14 = {1012; []} |
19 | é åèŠçŽ | -//- | ïŒ$ var14-> 1ïŒ | n / aã | n / a | ãªã | ãªã | 0 | -//- |
n / aã -䜿çšãããŸããã n / a -該åœãªã
ããŒãã«ã®è¡ã³ã¡ã³ãïŒ
1.å€æ°ã¯äœæãããŸãããäœãå²ãåœãŠãããŠããŸããã ããããå€æ°ã«äœãå«ãŸããŠããªããã®ãããªå€æ°ã
2.ãã®ãããªåŒãå€æ°ã«å²ãåœãŠããšãç°å¢å€æ°ããã°ããŒãã«å€æ°ãåé€ãããŸãã
3.空ã®å€æ°ãäœæããæšæºçãªæ¹æ³ã å€æ°ã«ã¯nilãå«ãŸããŸãã
4.空è¡ã®å²ãåœãŠã ããã§ã¯ãã¹ãŠãæããã§ãã
5.ãã®ãããªåŒã¯ã3ã®ããã«[] nilã®åçŽãªå²ãåœãŠã«äŒŒãŠããããšãããããŸããããã¯[]å ã«ååšããªãã³ãã³ããšãã®ã³ãã³ãã®çµæãnilãäžããããã ãšæããŸã
6ã7ã8ãäžæ¬åŒ§ãå²ãåœãŠããšãé åã¯ç©ºã§ãããé åã«ãªããŸãã ããŒãã«å ã®ã¬ã³ãŒãã®çµæã¯åãã§ããããããã®é åã®èŠçŽ ã®ããããã£ã«ã¯é©çšãããªãããšã«æ³šæããŠãã ããã é åèŠçŽ ã®ããããã£ã«ã€ããŠã¯ã以äžã§èª¬æããŸãã
9ã10ãåçŽãªããŒã¿åã ãã¹ãŠãããªãæçœã§ãã
11. 1ã€ã®èŠçŽ ã®é åãçµæã«ãã{555;}ã¯{555}ãšçããããšã«æ³šæããŠãã ããã
é åã«ã¯ãç°ãªãããŒã¿åã®èŠçŽ ãå«ãŸããå ŽåããããŸãã é åèŠçŽ ã®ããããã£ã調æ»ãããšãäºæž¬å¯èœãªçµæãåŸãããŸãã
15ã16ã17. äœããªãé åã®èŠçŽ ã®äžã€ã é åèŠçŽ ã¯ãäžããããã¿ã€ããšå€ã®å€æ°ãšå®æ°ãšåãããããã£ãæã£ãŠããŸãã ãã©ã°ã©ã2ã«é¡äŒŒããŠããŸãã
18ã19.ãã©ã°ã©ã3ãšã®é¡äŒŒæ§ããããŸãã
ç§ã®æèŠã§ã¯ããã®ç 究ã¯å°ãç©è°ãéžããã®ã§ããããšãå€æããŸããããã«ãªã¹ããããã¯ããã£ãã¯ã®ç解ã«ããå€ãã®ç§©åºãããããããšãæ¬åœã«æåŸ ããŠããŸãã è¿œå ã®è£åãšããŠããã°ããããµãŒãã¹FreeDNS.afraid.orgã®åçDNSãæäœããããã®ã¹ã¯ãªãããå ¬éããŸãã
FreeDNS.afraid.orgã®ã¹ã¯ãªãã
䌌ããããªã¹ã¯ãªãããããã€ãèŠãããŸããããå¶éãç°ãªãããæ°ã«å ¥ããªãã£ãã®ã§ãå®å šã«èªåã«åã£ãèªè»¢è»ãäœãããšã«ããŸããã
åºç€ãšããŠãç§ã¯LESHIYODESSAããã¹ã¯ãªãããåããŸãã ã åçDNSã¬ã³ãŒãã®çŸåšã®ã¢ãã¬ã¹ãä¿åããããã«ãã¡ã€ã«ã䜿çšãããå®æçã«è§£æããã圌ã®ã¢ã«ãŽãªãºã ã¯ããŸã奜ãã§ã¯ãããŸããã§ãããããã«ãã¹ã¯ãªããã¯ç°ãªãã¬ã³ãŒãã®æŽæ°ããµããŒãããŠããŸãããããã¯ãã¹ã¯ãªãããäŒæããããšãææ¡ããŠããŸãããããã¯ç¹å®ã®IPã®ã¬ã³ãŒããæŽæ°ããåé¡ã解決ããŸããäœæãžã ãã®ãããå®éã«ã¯ãããã€ãã®ãšã³ããªãšã¯ç¡é¢ä¿ã«ãDHCPçµç±ã§åä¿¡ããã€ã³ã¿ãŒãã§ã€ã¹ã®ç£èŠå¯Ÿè±¡IPã¢ãã¬ã¹ãå€æŽããããã«ãå®æçãªæŽæ°ïŒ1æéééã§ïŒãè¡ãä¿¡é Œæ§ã®é«ãã¡ã«ããºã ã§ãã¡ã€ã«ã䜿çšããŠäœæ¥ã眮ãæããç¬èªã®ã¹ã¯ãªãããäœæããŸããã
FreeDNS.afraid.orgã®ãµããã¡ã€ã³ã®ååãšãã®ããã·ã¥ãWANã€ã³ã¿ãŒãã§ã€ã¹ã®ååã®é åã宣èšããããããIPã¢ãã¬ã¹ã远跡ããŸãã ãŸããã¬ã³ãŒãã®æ°ïŒQuantïŒãé åã®ãµã€ãºãŸãã¯æåã§èšå®ããŸãã
:local SubdomainHashes {"U3dWVE5V01TWxPcjluEo0bEtJQWjg5DUz=";"U3pWV5VFTWxPcjlOEo0EtJpOE1MAyDc="} :global DNSDomains {"aaa.xyz.pu";"bbb.xyz.pu"} :global WANInterfaces {"ether4-WAN-Inet";"ether3-WAN-Beeline"} :global Quant [:len $DNSDomains]
ãã«ããŒå€æ°ã宣èšããŸãïŒ
SkipCounters-ç£èŠå¯Ÿè±¡ã€ã³ã¿ãŒãã§ãŒã¹ã®æ€èšŒã«ãŠã³ã¿ãŒã®é å
LastIPsã¯ãFreeDNSã«æ¢ã«éä¿¡ãããŠããIPã¢ãã¬ã¹ã®é åã§ãã
ã«ãŠã³ã¿ã®é åã䜿çšãããšããã€ãããã¯DNSã¬ã³ãŒããäºãã«ç¬ç«ããŠæŽæ°ã§ããŸãã
ãŸãã空ã®å€æ°å®£èšãäœæããŸãïŒglobal SkipCounters ããã®ãããªå®£èšã«ãããæ°ããã°ããŒãã«å€æ°ãäœæããããç°å¢å€æ°ãšãã®å€ã§æ¢åã®å€æ°ãäžæžãããã«äœ¿çšã§ããŸãã
次ã®æ§æã¯ãæ°ããäœæãããå€æ°ã«å¯ŸããŠæ©èœããããŒã¿åãé åã§ãªãå Žåã«ãã§ãã¯ãããåãé åã«å€æŽãããå€æ°ã®å€ãå²ãåœãŠãããŸãã ãããã£ãŠãåºåã§ã¯ãå¿ èŠãªå€ã§åæåãããé ååå€æ°ããããŸãã
:global SkipCounters :if ([:typeof $SkipCounters] != "array") do={ :set SkipCounters {""} :for i from=0 to=($Quant-1) do={:set ($SkipCounters->$i) 1} } :global LastIPs :if ([:typeof $LastIPs] != "array") do={ :set LastIPs {""} :for i from=0 to=($Quant-1) do={:set ($LastIPs->$i) ""} }
远跡æŽæ°ã¢ã«ãŽãªãºã èªäœããããŸããã
dhcp-clientããçŸåšã®IPã¢ãã¬ã¹ãååŸããŸãã ãã®åŸãæãèå³æ·±ãã
[/ ip dhcp-client get [find where interface =ïŒ$ WANInterfaces-> $ iïŒ] address]ã³ãã³ãã¯éåžžãIPã¢ãã¬ã¹ãå«ãæåå以å€ã®ãã¹ãŠãè¿ãããšãã§ãããããéåžžã¯CurrentIPå€æ°ã®å€ãæŽæ°ããŸãã è¿ãããå€ã¯ãIPãŸãã¯nilã®æååã®ããããã§ãããŸãã¯ãã©ã³ã¿ã€ã ãšã©ãŒãçºçããã³ãã³ãã¯CurrentIPãæŽæ°ããŸããã ãããã£ãŠãäžèšã®æ瀺çãªå®£èšè¡ãå ¥åããŸãïŒlocal CurrentIP "" ã ãããŠãã³ãã³ããå®è¡ããåŸãCurrentIP㯠""ãnilããŸãã¯IPã¢ãã¬ã¹ãæã¡ãŸãã
äžã§æžããããã«ãæŒç®åïŒlenã®å®å®æ§ãæãé«ãã®ã§ãåä¿¡ããŒã¿ã®åŠ¥åœæ§ããã§ãã¯ããããã«ããã«äœ¿çšããŸã[ïŒlen $ CurrentIP]> 0 ã ãŸããã«ãŠã³ã¿ã®å€ãç£èŠãã> = 60ã®å Žåããªã¯ãšã¹ãã匷å¶çã«FreeDNSã«éä¿¡ããŸãã ãããã£ãŠãéä¿¡ã®åé¡ã«å¯Ÿããã¢ã«ãŽãªãºã ã®å®å®æ§ãåäžããŸãã ã·ã§ããŒã§ã¹ã¯ãªããã1åã«1åå®è¡ããã®ã§ãå¿ é ã®æŽæ°æéã¯çŽ1æéã§ãFreeDNSãµãŒãã¹ã«å€§ããªè² è·ã¯ããããŸããã
ä»ã«æ³šæãæã䟡å€ããããã®ã ãã©ã¡ãŒã¿ãŒ "ïŒaddress ="ã¯ãæŽæ°èŠæ±ã®URLã«ååšããŸãã$ CurrentIPããã®ãã©ã¡ãŒã¿ãŒã䜿çšãããšãèªåã¢ãã¬ã¹ïŒèŠæ±ã®éä¿¡å ã®ã€ã³ã¿ãŒãã§ã€ã¹ïŒã§ã¯ãªãããµããã¡ã€ã³ã®IPã¢ãã¬ã¹ãæ瀺çã«æå®ã§ããŸãã
:for i from=0 to=($Quant-1) do={ :local CurrentIP "" :set CurrentIP [/ip dhcp-client get [find where interface=($WANInterfaces->$i)] address] :set CurrentIP [:pick $CurrentIP 0 ([:len $CurrentIP]-3)] # :log info ("Current SkipCounter$i: ".($SkipCounters->$i)) :if ([:len $CurrentIP] > 0 and ($CurrentIP != ($LastIPs->$i) or ($SkipCounters->$i) > 59)) do={ :if ($CurrentIP != ($LastIPs->$i)) do={ :log info ("Service Dynamic DNS: Renew IP: ".($LastIPs->$i)." for ".($DNSDomains->$i)." to $CurrentIP") } /tool fetch url=("http://freedns.afraid.org/dynamic/update.php\?".($SubdomainHashes->$i)."&address=".$CurrentIP) keep-result=no :set ($LastIPs->$i) $CurrentIP :set ($SkipCounters->$i) 1 } else={ :set ($SkipCounters->$i) (($SkipCounters->$i) + 1) } }
MultiFreeDNSã¹ã¯ãªããå
šäœ
# MultiFreeDNS :local SubdomainHashes {"U3dWVE5V01TWxPcjluEo0bEtJQWjg5DUz=";"U3pWV5VFTWxPcjlOEo0EtJpOE1MAyDc="} :global DNSDomains {"aaa.xyz.pu";"bbb.xyz.pu"} :global WANInterfaces {"ether4-WAN-Inet";"ether3-WAN-Beeline"} :global Quant [:len $DNSDomains] :global SkipCounters :if ([:typeof $SkipCounters] != "array") do={ :set SkipCounters {""} :for i from=0 to=($Quant-1) do={:set ($SkipCounters->$i) 1} } :global LastIPs :if ([:typeof $LastIPs] != "array") do={ :set LastIPs {""} :for i from=0 to=($Quant-1) do={:set ($LastIPs->$i) ""} } :for i from=0 to=($Quant-1) do={ :local CurrentIP "" :set CurrentIP [/ip dhcp-client get [find where interface=($WANInterfaces->$i)] address] :set CurrentIP [:pick $CurrentIP 0 ([:len $CurrentIP]-3)] # :log info ("Current SkipCounter$i: ".($SkipCounters->$i)) :if ([:len $CurrentIP] > 0 and ($CurrentIP != ($LastIPs->$i) or ($SkipCounters->$i) > 59)) do={ :if ($CurrentIP != ($LastIPs->$i)) do={ :log info ("Service Dynamic DNS: Renew IP: ".($LastIPs->$i)." for ".($DNSDomains->$i)." to $CurrentIP") } /tool fetch url=("http://freedns.afraid.org/dynamic/update.php\?".($SubdomainHashes->$i)."&address=".$CurrentIP) keep-result=no :set ($LastIPs->$i) $CurrentIP :set ($SkipCounters->$i) 1 } else={ :set ($SkipCounters->$i) (($SkipCounters->$i) + 1) } }