Mikrotik RouterOS Script-peanut shell dynamic Domain name analysis

Source: Internet
Author: User
Tags routeros domain name server

1, SETP1

Turn on the NTP protocol and modify the time zone:

/system NTP Client set Enabled=yes server-dns-names=1.centos.pool.ntp.org/system clock set time-zone-name=asia/ Shanghai

Detects if the route communicates with the dynamic Domain name server:

/ping ddns.oray.com

2, SETP2

Before modifying the script, assemble a URL test:

/tool fetch url= "http://ddns.oray.com/ph/update\?hostname=example.oicp.net&myip=119.128.4.27" Mode=http user= " Example "password=" pwd "

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/74/4B/wKiom1YYhG-gXtnAAADDe6UGBoM574.jpg "title=" Checkstart.png "style=" Float:none; "alt=" wkiom1yyhg-gxtnaaadde6ugbom574.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/74/48/wKioL1YYhIiyOz0gAACO9izsoZM127.jpg "style=" float: none; "title=" Check.png "alt=" Wkiol1yyhiiyoz0gaaco9izsozm127.jpg "/>

Try to brush a wrong IP try:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/74/48/wKioL1YYhIiAIJhNAADMhjbFBF8499.jpg "title=" Checkerrstart.png "style=" Float:none; "alt=" wkiol1yyhiiaijhnaadmhjbfbf8499.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/74/4B/wKiom1YYhG7TYQ_YAACD2b5Y_aw370.jpg "style=" float: none; "title=" Checkerr.png "alt=" Wkiom1yyhg7tyq_yaacd2b5y_aw370.jpg "/>

3, SETP3

The variable definition is then added so that it can automatically get the IP address that is currently dialed:

Before writing the script, look at your own interface:

/IP Address Print

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/74/48/wKioL1YYhi6ANH_YAADTKNalAAo119.jpg "title=" Ip_ Address_print.png "alt=" Wkiol1yyhi6anh_yaadtknalaao119.jpg "/>

Modify the script according to the correct interface name:

{: local ipaddr;:local Server "http://ddns.oray.com";: local domain "example.oicp.net";: Local par "/ph/update\?& Hostname= $domain &myip= $ipaddr ";: Local Users" Example ";: Local paswd" PWD ";: set ipaddr [/IP address get [/IP address fi nd interface=chinanet] address];:set ipaddr [:p ick $ipaddr 0 ([: Len $ipaddr]-3)];/tool fetch url= ($server. $par) mode=ht TP user= $users password= $paswd;}

The above parameters need to be modified:

Server//fixed to http://ddns.oray.com

Domain//You apply for a peanut shell

Users//Login peanut Shell user name

PASWD//Log in the Peanut shell password

interface//The name of the virtual interface queried above

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/74/4B/wKiom1YYhG_BSPX7AACFt_r_j6Y887.jpg "title=" Checkscript.png "style=" Float:none; "alt=" wkiom1yyhg_bspx7aacft_r_j6y887.jpg "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/74/48/wKioL1YYhInD65wHAAG2DOxY3_w159.jpg "title=" Checkscriptstart.png "style=" Float:none; "alt=" wkiol1yyhind65whaag2doxy3_w159.jpg "/>

4, SETP4

To set up scripts and Scheduled tasks:

"/system/scripts" Settings directory, click the "+" button

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/74/4C/wKiom1YYidPCvLLbAAEpSknXTCE541.jpg "title=" Script.pin.png "alt=" Wkiom1yyidpcvllbaaepsknxtce541.jpg "/>

"/system/scheduler" Settings directory, click the "+" button

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/74/49/wKioL1YYignznmJWAAEBXyp038k050.jpg "title=" Schedule.png "alt=" Wkiol1yyignznmjwaaebxyp038k050.jpg "/>

5, SETP5

Detection is working correctly:

Try to brush a wrong IP try:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/74/48/wKioL1YYhIiAIJhNAADMhjbFBF8499.jpg "title=" Checkerrstart.png "alt=" wkiol1yyhiiaijhnaadmhjbfbf8499.jpg "style=" float:none; "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/74/4B/wKiom1YYhG7TYQ_YAACD2b5Y_aw370.jpg "title=" Checkerr.png "alt=" wkiom1yyhg7tyq_yaacd2b5y_aw370.jpg "style=" float:none; "/>

Wait for the script to execute:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/74/4C/wKiom1YYiojjtYxKAADajEyC4W8837.jpg "title=" Runcount.png "alt=" Wkiom1yyiojjtyxkaadajeyc4w8837.jpg "/>

Test again after automatic execution:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/74/4B/wKiom1YYhG_BSPX7AACFt_r_j6Y887.jpg "title=" Checkscript.png "alt=" wkiom1yyhg_bspx7aacft_r_j6y887.jpg "style=" float:none; "/>

--------------------------------------------------------

Reference documents:

Http://service.oray.com/question/869.html

Http://open.oray.com/wiki/doku.php?id=%E6%96%87%E6%A1%A3:%E8%8A%B1%E7%94%9F%E5%A3%B3:http%E5%8D%8F%E8%AE%AE%E8 %af%b4%e6%98%8e

This article is from the "Old Tan Linux Blog" blog, please be sure to keep this source http://cmdschool.blog.51cto.com/2420395/1701464

Mikrotik RouterOS Script-peanut shell dynamic Domain name analysis

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.