返回列表 發帖
本帖最後由 bky16 於 2013-3-27 11:07 編輯

回復 60# mrandrewchan


    Tks for your advice, but I can do "Tools>Ping>cn.yahoo.com" without problem.

I just can't do "New Terminal>ping cn.yahoo.com".

TOP

不明原因, 有冇其他 CHing 幫忙
AC

TOP

不明原因, 有冇其他 CHing 幫忙
mrandrewchan 發表於 2013-3-27 11:47



    請問你可唔可以 "New Terminal>ping cn.yahoo.com".

TOP

Yes,

You can create read only user for your frd access your RouterOS to check setting.

system > users > + > input user name e.g.guest > group : read > input password > confirm password
AC

TOP

回復 64# mrandrewchan


    哦!我唔得!
如果有时间可以,唔该!
暂时个IP係
119.123.68.175
user: guest
password: guest

Tks

TOP

Check without DNS input

IP > DNS > input 4.2.2.2 & 8.8.8.8
AC

TOP

Strange, read the figure:
附件: 您需要登錄才可以下載或查看附件。沒有帳號?註冊

TOP

回復 66# mrandrewchan


    see what you mean, and I added it accordingly.
But I am wondering what is the differece of
1. adding it in the  first coming up dialog
2. press the static button, adding it

TOP

It is working now. Tks a lot

TOP

回復 69# bky16
Please delet the guest account or disable
AC

TOP

回復 70# mrandrewchan


    Tks a lot for helping and reminding me.

TOP

So, it is working perfectly on RB750 v5.24:
System>Script>add script "dyndns"

############
# Set needed variables
############
# Your DynDNS account user-name, password & host-name.
:local username "yourusername"
:local password "yourpassword"
:local hostname "yourhostname"

# Which interface are we checking if DHCP has changed? [interfaces | name column in winbox]
:local DHCPInterface "yourinterface"
############
# This is the name of the file where the last recorded IP will be stored, as well as the file name of the DynDNS response.
# Make sure if another script is using files, that these names don't conflict.
# You probably also want to be sure they aren't the same as any other files on the disk - because you'll be clobbering those files.
# Finally, while I'm not aware of any "reserved" file names on the disk, it would be wise to avoid something that might conflict.
# Prefixing them with something to associate them with this script would probably be a good thing.
# You can point these files at your SD-disk too, if you have an SD card installed and ready on your RB. Just prefix the path appropriately:
# something like this [:local vLastIPFileName "micro-sd/dyndns-lastip.txt"] (don't put a leading slash)
# A user reported a bug if you use the RB flash and prefix the path with a [/]
# So for RB based flash, it's probably safest to use just something like [:local vLastIPFileName "dyndns-lastip.txt"] and not [:local vLastIPFileName "/dyndns-lastip.txt"]
# You ***MUST*** use a .txt extension. Just an oddity of ROS. Move along now.
# Code ForDD
:local vLastIPFileName "dyndns-lastip.txt"
:local vDynDNSResponseFile "dyndns-resp.txt"
# /dyndns.txt

############
# END Set needed variables
############

:local vlen;
:local vRawIP;
:local vJustIP;
:local currentIP
:local previousIP
:local vlocalurl
:local vIPChanged false
:local dyndnsresult
:local result

# Check for file existance, if not create it
# We need to do this before we try to read or write to files...
:local check [/file find name=$vLastIPFileName]
:if ( $check = "" ) do= {
   /file print file=$vLastIPFileName
   :delay 2
   /file set [/file find name=$vLastIPFileName] contents=""
}

# Get the last saved IP from the file.
:set previousIP [/file get $vLastIPFileName contents]
#:put $previousIP


# print some debug info
:log info ("UpdateDynDNS: username = $username")
:log info ("UpdateDynDNS: password = $password")
:log info ("UpdateDynDNS: hostname = $hostname")
:log info ("UpdateDynDNS: previousIP = $previousIP")
:log info ("UpdateDynDNS: DHCPInterface = $DHCPInterface")


# This code gets the current IP from the interface.
# The interface we're checking should be set above.
# get the raw IP from the interface, which includes a mask.
:set vRawIP [:tostr [/ip address get [find interface=$DHCPInterface] address]]

#Strip the netmask off the vRawIP address.
:for i from=( [:len $vRawIP] - 1) to=0 do={
        :if ( [:pick $vRawIP $i] = "/") do={
                :set vJustIP [:pick $vRawIP 0 $i]
        }
}
:set currentIP $vJustIP

# Determine if dyndns update is needed
# more dyndns updater request details http://www.dyndns.com/developers/specs/syntax.html
# Update if the currentIP isn't equal to previousIP.
:if (($currentIP != $previousIP)) do={
        :log info "CurrentIP: $currentIP - PreviousIP: $previousIP"
        :set vlocalurl ("http://" . "$username" . ":" . "$password" . "@" . "members.dyndns.org" . "/nic/update?hostname=" . "$hostname" . "&myip=" . "$currentIP")   
        /tool fetch mode=http url=$vlocalurl dst-path=$vDynDNSResponseFile
        :set result [/file get $vDynDNSResponseFile contents]
        :set vIPChanged true
} else={
   :log info ("UpdateDynDNS: No dyndns update needed")
}

# Get the result status code and pull it out for use.
# IF IPChanged = true
#        Get result code
#                Check DynDNS result
#                if good or nochg, then
#                        :set previousIP $currentIP
#                        /file set [/file find name=$vLastIPFileName] contents="$currentIP"
#                        also post the result to the log file       
#                else badauth or !donator or notfqdn, nohost, abuse, dnserr, 911
#                        post to log file
#                        Don't update previousIP or vLastIPFileName file
:if ($vIPChanged=true) do={
        :set result [/file get $vDynDNSResponseFile contents]
        :local endLoc [:find $result " " -1]
        :set dyndnsresult [:pick $result -1 ($endLoc)]
        :put $dyndnsresult
                :if (($dyndnsresult = "good") || ($dyndnsresult = "nochg") ) do={
                        :set previousIP $currentIP
                        :log info ("UpdateDynDNS: Dyndns update needed")
                        :log info ("UpdateDynDNS: Dyndns Update Result: ".$result)
                        /file set [/file find name=$vLastIPFileName] contents="$currentIP"
                        } \
                else={
                        :log info ("UpdateDynDNS: Dyndns update needed")
                        :log info ("DynDNS Update FAILED")
                        :log info ("UpdateDynDNS: Dyndns Update Result: ".$result)
                }
}

New Terminal> /system scheduler add name=dyndns interval=00:01 on-event="/system script run dyndns\r\n"

TOP

离我嘅目标又行近一步啦!

TOP

回復 72# bky16

CHing,我看到是有个符号!请看下图, 是你放入去?还是其他呢?

附件: 您需要登錄才可以下載或查看附件。沒有帳號?註冊

TOP

回復 74# 角色


    唔系,我网上抄嘅,无留意一个!

TOP

返回列表