WireGuard AllowedIPs 实际做什么?

Wireguard 的 allowed_ips 字段做两件不同的事。让我们考虑以下 WireGuard 配置(由 WireguardConfig Site2Site 示例生成):

wg_config_example.conf
[Interface]
# Name = office1.mydomain.org
PrivateKey = ......
Address = 10.82.85.1/24
ListenPort = 19628

[Peer]
# Name = office2.mydomain.org
PublicKey = ...
AllowedIPs = 10.82.85.2/32, 192.168.200.0/24
PersistentKeepalive = 60

我们可以看到对于对等方 office2.mydomain.orgAllowedIPs 字段设置为 10.82.85.2/32, 192.168.200.0/24

AllowedIPs两件事

特别注意第二点。来自给定对等方且源 IP 地址未列在 AllowedIPs **中的任何数据包将被丢弃!**虽然这不替代防火墙,但它作为 Wireguard 安全模型的组成部分。


Check out similar posts by category: VPN, Wireguard