RouterOS 实用脚本

2023-12-24 21:13:36
This post is also available in English and alternative languages.

更新 WireGuard peer 地址。

1
2
:global ip [:resolve vpn.example.com]
/interface/wireguard/peers/set endpoint-address=$ip [find where comment="test"]

获取公网 IP。

1
2
:global ip [([/tool/fetch "http://myip.dnsomatic.com/" output=user as-value]->"data")]
:put $ip

获取网页 response body。

1
2
:global result [([/tool/fetch "http://example.com" output=user as-value]->"data")]
:put $result

配置 NTP 服务器。

1
2
3
4
5
6
7
8
9
10
11
12
/system ntp client
set enabled=yes
/system ntp server
set enabled=yes
/system ntp client servers
add address=pool.ntp.org
add address=time.apple.com
add address=time.google.com
add address=time.windows.com
add address=time.cloudflare.com
add address=stdtime.gov.hk
add address=time1.cloud.tencent.com
Prev
2023-12-24 21:13:36
Next