bmy001 最近的时间轴更新
bmy001

bmy001

V2EX 第 72039 号会员,加入于 2014-08-26 15:52:47 +08:00
54 S 64 B
bmy001 最近回复了
See: https://wiki.archlinux.org/title/WireGuard

After resolving a server's domain, WireGuard will not check for changes in DNS again.
If the WireGuard server is frequently changing its IP-address due DHCP, Dyndns, IPv6, etc., any WireGuard client is going to lose its connection, until its endpoint is updated via something like wg set "$INTERFACE" peer "$PUBLIC_KEY" endpoint "$ENDPOINT".
Also be aware, if the endpoint is ever going to change its address (for example when moving to a new provider/datacenter), just updating DNS will not be enough, so periodically running reresolve-dns might make sense on any DNS-based setup.
Luckily, wireguard-tools provides an example script /usr/share/wireguard-tools/examples/reresolve-dns/reresolve-dns.sh, that parses WG configuration files and automatically resets the endpoint address.
One needs to run the /usr/share/wireguard-tools/examples/reresolve-dns/reresolve-dns.sh /etc/wireguard/wg.conf periodically to recover from an endpoint that has changed its IP.
One way of doing so is by updating all WireGuard endpoints once every thirty seconds[6] via a systemd timer:

/etc/systemd/system/wireguard_reresolve-dns.timer

[Unit]
Description=Periodically reresolve DNS of all WireGuard endpoints

[Timer]
OnCalendar=*:*:0/30

[Install]
WantedBy=timers.target


/etc/systemd/system/wireguard_reresolve-dns.service

[Unit]
Description=Reresolve DNS of all WireGuard endpoints
Wants=network-online.target
After=network-online.target

[Service]
Type=oneshot
ExecStart=/bin/sh -c 'for i in /etc/wireguard/*.conf; do /usr/share/doc/wireguard-tools/examples/reresolve-dns/reresolve-dns.sh "$i"; done'

Afterwards enable and start wireguard_reresolve-dns.timer
好东西 感谢楼主
@shunia 高精 ip 的话,常用的 ip 变化没那么频繁.一般一周 一个月更新一次就行 pc 也可以写一个 crontab 来自动化执行
@Misakax 😂 我暂时只适配了 dler 的 如果不是 就得自己改一下 proxies- providers 了
@amamiya 抽空我试一下
@isad 这是自己做的路由,直接按地区走机场的专线落地对应地区了。 至少少了国内出国这部分线路。 虽然落地后也有类似的问题,不过只要落的不差太多,就会就近路由到对应 AS 的
楼主可以看看 ipinfo.io 他们家的数据库
@sss15 clash 的配置我还没写。mmdb 的话倒是通用的,但是分流规则啥的实际上写法还是和 quantmultx 略有区别。后续应该还是要再写一个模版 定时生成主流配置
212 天前
回复了 eggsblue 创建的主题 Apple 想买 待机显示 的充电底座
小米的 magsafe 充电宝,平时就用来当底座用,应急还能当个外接电池
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3333 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 15ms · UTC 12:05 · PVG 20:05 · LAX 05:05 · JFK 08:05
Developed with CodeLauncher
♥ Do have faith in what you're doing.