返回列表 發帖
本帖最後由 gfx86674 於 2018-9-6 22:37 編輯

很簡單的要求,樓主的vpn site-to-site應該會使用到profile吧...
何需工作排程? 把renew public工作放到on-down欄位 ,vpn斷線立即執行豈不更佳
  1. :local public 0
  2. :while ([:typeof $public]!="str") do={
  3. /ip dhcp-c release [find interface=ether1] ; :delay 5s
  4. :set public [/ip dhcp-c get [find interface=ether1] address]
  5. }
複製代碼
附件: 您需要登錄才可以下載或查看附件。沒有帳號?註冊

TOP

本帖最後由 gfx86674 於 2018-9-7 02:22 編輯

回復 6# yiucsw
很簡單的事不要用很複雜的方法處理 ,您server(香港)的ddns可以多設些不同廠商啊,
然後讓client(中國路由器)去嘗試撥號看誰會先成功.

vpn-server profile既然可以控制public更新 ,那vpn-client profile自然也可以改變client自己的撥號地址.
假設vpn-server有3組ddns ,那vpn-client profile只要設:
  1. :local ready no
  2. :local connect [/interface sstp-c get $interface connect-to]
  3. :local ddns1 "abc123.noip.com"
  4. :local ddns2 "abc123.duckdns.org"
  5. :local ddns3 "abc123.changeip.org"

  6. :if (!$ready && $connect=$ddns1) do={
  7. /interface sstp-c set $interface connect-to=$ddns2 ; :set ready yes}
  8. :if (!$ready && $connect=$ddns2) do={
  9. /interface sstp-c set $interface connect-to=$ddns3 ; :set ready yes}
  10. :if (!$ready && $connect=$ddns3) do={
  11. /interface sstp-c set $interface connect-to=$ddns1 ; :set ready yes}
複製代碼
每當vpn-client撥號斷線或失敗,就換下一組ddns嘗試直到成功為止.您說這方法是不是務實的多
附件: 您需要登錄才可以下載或查看附件。沒有帳號?註冊

TOP

本帖最後由 gfx86674 於 2018-9-8 00:03 編輯
好像只會執行一次

但有時release 一次不會 get new public ip
vpnuser 發表於 2018-9-7 22:03

script是用迴圈(while)動作 ,
會不斷的release ether1,每次間隔5秒,直至ether1抓到新public address才停止.

TOP

你好,你这个能不能定义条件为ping aa.com ,当ping 不通的时候,再/ip dhcp-c release [find inter ...
161698 發表於 2019-1-10 13:34

可以啊,用netwatch即可。

TOP

返回列表