找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 1536|回复: 10

[Router OS] 请教ros设置DDNS的问题

[复制链接]
本帖最后由 evanzing 于 2023-3-15 21:28 编辑

ROS为拨号路由,设置了分流,chinaip以外走旁路由192.168.2.2

ROS的DNS设置为192.168.2.2
ROS设置scheduler,scripts自动更新动态域名
问题如下:
当勾选pppoe勾选use peer dns后,dns会在192.168.2.2下面增加本地运营商DNS,脚本可以更新动态域名IP
当取消勾选PPOE的use peer dns后,脚本无法获取IP,无法更新动态域名---------但是家里网络一切正常,smartdns也能正常工作,NSLOOKUP查询只有唯一IP.

请问应该如何设置,才能在不勾选USE PEER DNS 的情况下,能正常更新IP呢
因为勾选了use peer dns后,虽然可以更新IP,但旁路由的SMARTDNS就失效了,NSLOOKUP会出现一堆IP地址
我的恩山、我的无线 The best wifi forum is right here.
我也没勾选没有你的这个问题,你ddns脚本或者dns设置有问题

点评

谢谢,确实不知道怎么去排查了! 感觉就是不勾选的话,ROS访问不了动态域名商去更新IP一样,但是其它设备都能正常上网 脚本是这样的 :local ednsuser "law23se1" :local ednspass "z3223pubyun1" :local ednsho  详情 回复 发表于 2023-3-15 22:17
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| | 显示全部楼层
linken88 发表于 2023-3-15 22:13
我也没勾选没有你的这个问题,你ddns脚本或者dns设置有问题

谢谢,确实不知道怎么去排查了!
感觉就是不勾选的话,ROS访问不了动态域名商去更新IP一样,但是其它设备都能正常上网
脚本是这样的
:local ednsuser "law23se1"

:local ednspass "z3223pubyun1"

:local ednshost "fange.f3322.net"

:local ednsinterface "pppoe-out1"

:local members "http://members.3322.net/dyndns/update?system=dyndns"

:local status

:local status [/interface get [/interface find name=$ednsinterface] running]

:if ($status!=false) do={

:local ednslastip [:resolve $ednshost]

:if ([ :typeof $ednslastip ] = nil ) do={ :local ednslastip "0" }

:local ednsiph [ /ip address get [/ip address find interface=$ednsinterface ] address ]

:local ednsip [:pick $ednsiph 0 [:find $ednsiph "/"]]

:local ednsstr "&hostname=$ednshost&myip=$ednsip"

:if ($ednslastip != $ednsip) do={/tool fetch url=($members . $ednsstr) mode=http user=$ednsuser password=$ednspass

:delay 2

:local result [/file get $ednshost contents]

:log info ($ednshost . " " .$result)

/file remove $ednshost;

}

}
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

:do {
:local ether
#DDNS帐号
:local user "law23se1"
#DDNS密码
:local pass "z3223pubyun1"
#DDNS域名
:local host "fange.f3322.net"
#以下不需要修改
:local status [/interface pppoe-client get [/interface pppoe-client find name="pppoe-out1"] running];
:if ($status=true) do={
:set ether "pppoe-out1"};
:if ($status=false) do={
:set ether ""};
:local oldip [:resolve $host]
:delay 5s
:local newip [ /ip address get [/ip address find interface=$ether ] address ]
:set newip [:pick $newip 0 [:find $newip "/"]]
:if ($oldip != $newip) do={
/tool fetch url=("http://members.3322.org/dyndns/update\?system=dyndns&hostname=$host&myip=$newip") mode=http user=$user password=$pass dst-path=$host
:log error ("\BE\C9\B5\C4IP\B5\D8\D6\B7\A3\BA: ".$oldip)
:log error ("\D0\C2\B5\C4IP\B5\D8\D6\B7\A3\BA: ".$newip)
:delay 3s
:local Result [/file get $host contents]
:if ([:find $Result "good"] != "nil") do={
:log error ($host." \B8\FC\D0\C2\B3\C9\B9\A6")
} else={
:log error ($host." \B8\FC\D0\C2\CA\A7\B0\DC")}
/file remove $host}}
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

用我上面发这个

点评

谢谢朋友,我去试试去  详情 回复 发表于 2023-3-15 22:29
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 来自手机 | 显示全部楼层
linken88 发表于 2023-3-15 22:28
用我上面发这个

谢谢朋友,我去试试去
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

你把members.3322.org 这个域名的IP写到DNS的静态地址里就行。

members.3322.org.        600        IN        CNAME        members.3322.net.
members.3322.net.        11724        IN        CNAME        dyndns.s.3322.net.
dyndns.s.3322.net.        600        IN        A        118.184.169.48

点评

谢谢您啦朋友,楼上那我是花生壳的,所以不太懂怎么改,然后请问您这个静态地址是写在哪里啊,ros还是smartdns还是openwrt呢,感谢  详情 回复 发表于 2023-3-16 17:35
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

这是偶的脚本,用dyndns和dynv6的服务


  1. :global ddnsuser USERNAME
  2. :global ddnspass PASSWORD
  3. :global theinterface "pppoe-out1"
  4. :global ddnshost1  HOSTNAME

  5. # IPv4
  6. :local test   [ /ip address get [/ip address find interface=$theinterface ] address ]
  7. :local ipfresh [ :pick $test 0 [find $test "/"]]

  8. #get from Web
  9. :set   test      ([/tool fetch url="https://ip6only.me/api/" as-value output=user]->"data")
  10. :local ipfresh6  [:pick $test ([:find $test "IPv6,"] + 5) [:find $test ",v" ] ]

  11. :if ([ :typeof $ipfresh6 ] = nil ) do={
  12.    :log info ("DynDNS: No ip address on $theinterface .")
  13. } else={
  14.    :log info ("DynDNS: IP-Fresh = $ipfresh6")

  15.    :global str1 "nic/update\?hostname=$ddnshost1&myip=$ipfresh,$ipfresh6&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG"

  16.    :set test ([/tool fetch url="https://members.dyndns.org/$str1" user=$ddnsuser password=$ddnspass  as-value output=user]->"data")

  17.    :global ipddns $ipfresh6
  18.    :local logstr  "DynDNS: IP updated to $ipfresh and  $ipfresh6!"
  19.    :log info $logstr
  20.    :put $logstr
  21. }
复制代码
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 来自手机 | 显示全部楼层
mantouboji 发表于 2023-3-16 14:17
你把members.3322.org 这个域名的IP写到DNS的静态地址里就行。

members.3322.org.        600        IN        CNAME        members ...

谢谢您啦朋友,楼上那我是花生壳的,所以不太懂怎么改,然后请问您这个静态地址是写在哪里啊,ros还是smartdns还是openwrt呢,感谢

点评

第一别用中国人提供的此类服务。 第二,IP/DNS/Static  详情 回复 发表于 2023-3-16 19:44
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

本帖最后由 mantouboji 于 2023-3-16 19:57 编辑
evanzing 发表于 2023-3-16 17:35
谢谢您啦朋友,楼上那我是花生壳的,所以不太懂怎么改,然后请问您这个静态地址是写在哪里啊,ros还是sma ...

第一别用中国人提供的此类服务。
第二,当然是在ros里设置,毕竟你的脚本在ros里运行。IP/DNS/Static

点评

谢谢您,问题已经搞定了! 能不能再追回一个问题 我的adguard+smartdns 为什么l2tp wireguard 从外网进去,可以有广告拦截效果,内网的完全没有效果呢  详情 回复 发表于 2023-3-16 22:07
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| | 显示全部楼层
本帖最后由 evanzing 于 2023-3-16 22:12 编辑
mantouboji 发表于 2023-3-16 19:44
第一别用中国人提供的此类服务。
第二,当然是在ros里设置,毕竟你的脚本在ros里运行。IP/DNS/Static

谢谢您,问题已经搞定了!

我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

欢迎大家光临恩山无线论坛上一条 /1 下一条

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-4-30 01:06

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com 举报电话:0519-86695797

快速回复 返回顶部 返回列表