大网数据广告活动
服务器运维问答

Wiregurard override wg0.conf

· 52CE 我爱测

I have successfully installed Wireguard on Debian Buster. Now I wanted to configure IPv6 afterwards. I have done that. But the settings inside the [Peer] -Section of wg0.conf do not seem to be persistent. systemctl stop [email om…

问题原文

原帖链接 · Gill-Bates · CC BY-SA 4.0

I have successfully installed Wireguard on Debian Buster. Now I wanted to configure IPv6 afterwards. I have done that. But the settings inside the [Peer]-Section of wg0.conf do not seem to be persistent.

systemctl stop [email omitted]
nano /etc/wireguard/wg0.conf

Result:

[Peer]
PublicKey = xxxxx
AllowedIPs = 10.200.200.2/32, xxx:xxxx:xx:xxx:100::2/72

After saving and restarting the service systemctl start [email omitted] the wg0.conf looks fine.

When I restart the VM or the Service again, all my additional settings are lost.

[Peer]
PublicKey = xxxxx
AllowedIPs = 10.200.200.2/32

Any idea?

Thats how my wg0.conf should look like

[Interface]
Address = 10.200.200.1/24
Address = xxxx:xxx:xx:xxx::1/72
DNS = 10.200.200.1
SaveConfig = true
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE; ip6tables -A FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -A POSTROU$
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE; ip6tables -D FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -D POSTR$
ListenPort = 51820
PrivateKey = xxx

[Peer]
PublicKey = xxx
AllowedIPs = 10.200.200.2/32, xxx:xxxx:xx:xxx:100::2/72

[Peer]
PublicKey = xxx
AllowedIPs = 10.200.200.3/32, xxx:xxxx:xx:xxx:100::3/72

[Peer]
PublicKey = xxx
AllowedIPs = 10.200.200.4/32, xxx:xxxx:xx:xxx:100::4/72

已采纳解答

原帖链接 · Gill-Bates · CC BY-SA 4.0

Solved the issue. The magic trick: always stop the Interface with wg-quick down wg0 before editing the wg0.conf File. systemctl stop [email omitted] will override the wg0.conf File after the next start.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2020-07-03)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。