Flint 4 - Wireguard server - only first allowed ip is working

Hi,

I have a Flint 4 running 4.9.2 firmware, and i have one peer on the wireguard server configured with 2 allowed ips:

config peers 'peer_2005'
option name 'router-travel'
option peer_id '2005'
option presharedkey_enable '1'
option presharedkey 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
option dns '192.168.27.253'
option mtu '1420'
option persistent_keepalive '25'
option public_key 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
option private_key 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
option client_ip '192.168.27.243/32'
option deprecated '0'
option enabled '1'
option allowed_ips '192.168.27.243/32, 192.168.179.0/24'

but only the 1st allowed ip is being considered:
wg

peer: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
preshared key: (hidden)
endpoint: xxx.xxx.xxx.xxx:56805
allowed ips: 192.168.27.243/32
latest handshake: 1 minute, 27 seconds ago
transfer: 31.45 KiB received, 24.37 KiB sent

ping -c3 192.168.27.243
PING 192.168.27.243 (192.168.27.243): 56 data bytes
64 bytes from 192.168.27.243: seq=0 ttl=64 time=4.425 ms
64 bytes from 192.168.27.243: seq=1 ttl=64 time=11.807 ms
64 bytes from 192.168.27.243: seq=2 ttl=64 time=9.580 ms

--- 192.168.27.243 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 4.425/8.604/11.807 ms

ping -c3 192.168.179.243
PING 192.168.179.243 (192.168.179.243): 56 data bytes
ping: sendto: Required key not available

Anyone has any idea what might be wrong here?

seems the problem is on /lib/netifd/proto/wgserver.sh load_peers()

get_peer_allow_ips allowed_ips $client_ip

it's getting only the client_ip instead of allowed_ips from the configuration.

also in get_peer_allow_ips() there is an issue i think, the ip is being stripped from the subnet part:

ip=`echo ${tmp_ip%%/*}`

Try using /24 rather than /32 on the peer on the server side, it limit communication to other peers otherwise.

Use either 0.0.0.0/0, ::0/0 on the client peer.

Or if you split tunnel use select ip there to decide which ip should go through the tunnel on the client peer.

0.0.0.0 means the whole internet.

Edit: Correction, I was wrong, there is no need to use a allowedip /24 on the server side on the peer, it must be set on the client peer and then those ip can still ping each other, overlapping ip or ip with /24 can add to the problem, you are observing.

this is on the server side, the wireguard server is configured on the flint4

and this is the allowed ips configured on the server:

option allowed_ips '192.168.27.243/32, 192.168.179.0/24'

but when the wireguard server starts on the flint4, then i check with wg command and it only shows 192.168.27.243/32 on the allowed ips, doesn't show the other "allowed ip" which is a subnet 192.168.179.0/24

Hi,

The Allowed IPs setting under Admin Panel → VPN → WireGuard Server → Profile configures AllowedIPs in the exported client configuration file, rather than the server-side AllowedIPs for that peer.


The server-side setting is integrated into WireGuard Server → Route Rules, since a corresponding return route is also needed. For your setup, add a route for 192.168.179.0/24 through the router-travel peer (192.168.27.243). Applying this route rule will automatically add the subnet to that peer’s server-side AllowedIPs.


I understand thank you for the information.

So basically the wireguard server allowed ips is equal to client_ip + the routes you setup on the Route Rules.

This implementation kind of breaks my setup, because i use bgp, i can learn the 192.168.179.0/24 route from wireguard peer or from openvpn peer, depending on which vpn my travel router is using to connect to the flint4.

Maybe would be good to have a specific config option for the allowed ips of the wireguard server instead of taking them from client_ip + Route Rules.

Thanks for explaining your setup. Since you use BGP to learn routes through either WireGuard or OpenVPN, we understand why you need to configure the server-side AllowedIPs independently of static routes. Our current design combines these settings to simplify configuration for typical use cases.

Thank you for the suggestion. We’ll discuss the option of separating these settings with our product team.