TLDR: some Wireguard client peers have option route_allowed_ips '1'
set and some don't. Everything works as expected. Is this a misconfiguration?
Prompted by a comment from @psherman about the option route_allowed_ips '1'
I'm wondering if there's a misconfiguration somewhere in my setup, specifically related to all "client" peers needing option route_allowed_ips '1'
or not. This is my first Wireguard setup directly on OpenWrt, so I don't quite understand all the knobs yet.
In this scenario there are 2 routers running OpenWrt 24.10.0: GW0
and GW1
. LAN1
is connected over Wireguard to LAN0
. In case of GW0
Wireguard is running on the router itself, and in case of GW1
it's running on WG1
that is a Raspberry Pi Zero 2W "hat". The LANs behind both routers are fully routable, along with the DNS resolution both ways. External "client" peers CL0...CLN
connect to GW0
and can be reached from both LANs.
Here's a crude network diagram:
[WG1]
|
[LAN0]---[GW0]---[Internet]---[GW1]---[LAN1]
|
|---[Internet]---[CL0]
|
|-[...]
|
|-[CLN]
GW0
, on 24.10.0
10.0.1.1/24
LAN0
10.0.3.1/32
Wireguard peer IP- Runs Wireguard “server” peer, plus listens to “clients” peers
- Runs Ardguard Home with DNS from
GW1
as one of the upstreams and rDNSs to resolve local andLAN1
hostnames - Doesn’t have explicit static routes
- Has port open for WG
GW1
site-to-site peer hasoption route_allowed_ips '1'
- Client peers don’t have
option route_allowed_ips
set
The question is about the GW0
side, but here's GW1
for completeness.
GW1
, also on 24.10.0
10.0.2.1/24
LAN1
- Has explicit static routes
10.0.1.0/24
and10.0.3.0/24
toWG1
10.0.2.30
WG1
, on a Raspberry Pi Zero 2W with Debian Buster connected through a USB gadget to the router
10.0.2.30
10.0.3.2/24
Wireguard peer IP- Runs Wireguard “client” peer to
GW0
- Runs Ardguard Home with DNS from
GW0
as one of the upstreams and rDNSs to resolve local andLAN0
hostnames - Has
net.ipv4.ip_forward=1
andnet.ipv4.conf.all.proxy_arp=1
set in/etc/sysctl.d/
- No other rules like masquerading, etc.
abbreviated /etc/config/network from GW0
config interface 'lan'
option device 'br-lan.101' # there are several VLANs
option proto 'static'
option ipaddr '10.0.1.1'
option netmask '255.255.255.0'
option ip6assign '60'
config interface 'wgsmth'
option proto 'wireguard'
option private_key 'xxx'
option listen_port '1234'
list addresses '10.0.3.1/24'
config wireguard_wgsmth
option description 'WG1 site-to-site'
option public_key 'xxx'
option persistent_keepalive '25'
option route_allowed_ips '1'
list allowed_ips '10.0.2.0/24'
list allowed_ips '10.0.3.2/32'
config wireguard_wgsmth
option description 'CL0 regular client'
option public_key 'xxx'
list allowed_ips '10.0.3.7/32'
abbreviated /etc/config/firewall from GW0
config rule
option name 'Allow Wireguard'
list proto 'udp'
option src 'wan'
option dest_port '1234'
option target 'ACCEPT'
example client peer config
[Interface]
PrivateKey = xxx
Address = 10.0.3.7/24
[Peer]
PublicKey = xxx
Endpoint = public.dns:1234
AllowedIPs = 0.0.0.0/0
PersistentKeepalive = 25
DNS = 10.0.1.1
The relevant routes that are created automatically on GW0
look like this, so I'm speculating site-to-site peer having option route_allowed_ips '1'
is enough.
10.0.2.0/24 dev wgminos proto static scope link
10.0.3.0/24 dev wgminos proto kernel scope link src 10.0.3.1
10.0.3.2 dev wgminos proto static scope link