Sysnet Board คู่มือ การใช้งานอุปกรณ์ Network

การ Config อุปกรณ์ เครือข่าย Network Device => อุปกรณ์ Mikrotik Router => หัวข้อที่ตั้งโดย: njtd เมื่อ วันที่ 4 พฤษภาคม 2013, 14:23:47

ชื่อ: LoadBalance 3 เส้นต้องการให้แต่ละเส้นมีชื่อ dyndns 1 ชื่อต่อหนึงเส้น ทำยังไงครับ
โดย: njtd เมื่อ วันที่ 4 พฤษภาคม 2013, 14:23:47
LoadBalance 3 เส้นต้องการให้แต่ละเส้นมีชื่อ dyndns 1 ชื่อต่อหนึงเส้น ทำยังไงครับ
เผือไว้สำหรับ เส้นใดเส้นหนึ่งเสีย จะได้ยังสามารถใช้ชื่ออื่นทำงานได้อยู่
ขอบคุณครับ
ชื่อ: Re: LoadBalance 3 เส้นต้องการให้แต่ละเส้นมีชื่อ dyndns 1 ชื่อต่อหนึงเส้น ทำยังไงครับ
โดย: yod เมื่อ วันที่ 9 พฤษภาคม 2013, 12:58:52


ต้องสร้าง 3 script เลยครับ ตรงตัวแปล grobal ให้แก้ไขไม่ให้เหมือนกันครับ
ชื่อ: Re: LoadBalance 3 เส้นต้องการให้แต่ละเส้นมีชื่อ dyndns 1 ชื่อต่อหนึงเส้น ทำยังไงครับ
โดย: yod เมื่อ วันที่ 9 พฤษภาคม 2013, 13:03:47
ตัวอย่างนะครับ

ตรง

:global dyndnsForce2
:global previousIP2

เปลี่ยนจาก
dyndnsForce --> dyndnsForce2
previousIP --> previousIP2

# Set needed variables
:local username "username"
:local password "password"
:local hostname "hostname"

:global dyndnsForce2
:global previousIP2

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

# get the current IP address from the internet (in case of double-nat)
/tool fetch mode=http address="checkip.dyndns.org" src-path="/" dst-path="/dyndns.checkip.html"
:delay 1
:local result [/file get dyndns.checkip.html contents]

# parse the current IP result
:local resultLen [:len $result]
:local startLoc [:find $result ": " -1]
:set startLoc ($startLoc + 2)
:local endLoc [:find $result "</body>" -1]
:local currentIP [:pick $result $startLoc $endLoc]
:log info "UpdateDynDNS: currentIP = $currentIP"

# Remove the # on next line to force an update every single time - useful for debugging,
# but you could end up getting blacklisted by DynDNS!

#:set dyndnsForce2 true

# Determine if dyndns update is needed
# more dyndns updater request details http://www.dyndns.com/developers/specs/syntax.html

:if (($currentIP != $previousIP2) || ($dyndnsForce2 = true)) do={
   :set dyndnsForce2 false
   :set previousIP2 $currentIP
   :log info "$currentIP or $previousIP2"
   /tool fetch user=$username password=$password mode=http address="members.dyndns.org" \
      src-path="nic/update?system=dyndns&hostname=$hostname&myip=$currentIP&wildcard=no" \
      dst-path="/dyndns.txt"
   :delay 1
   :local result [/file get dyndns.txt contents]
   :log info ("UpdateDynDNS: Dyndns update needed")
   :log info ("UpdateDynDNS: Dyndns Update Result: ".$result)
   :put ("Dyndns Update Result: ".$result)
} else={
   :log info ("UpdateDynDNS: No dyndns update needed")
}


ชื่อ: Re: LoadBalance 3 เส้นต้องการให้แต่ละเส้นมีชื่อ dyndns 1 ชื่อต่อหนึงเส้น ทำยังไงครับ
โดย: njtd เมื่อ วันที่ 16 พฤษภาคม 2013, 16:19:59
ขอบคุณมากครับคุณยอด
เดี๋ยวจะลองดูครับ