Sunday, November 30, 2025

Wireguard AllowedIPs in hostname.wg0

Hello misc,

I set up an OpenBSD Wireguard client connecting to my existing OpenBSD Wireguard server.
It connects, but I'd like to have several subnets allowed, and I can't figure out the appropriate syntax. 
I'd like the equivalent of :


my hostname.wg0 currently looks like:

# cat /etc/hostname.wg0                                           

#server
wgpeer '(redacted)' wgendpoint (redacted).org 51820 wgaip 10.1.1.0/24 wgpsk '(redacted)'

# setting VPN address
inet 10.1.1.100 255.255.255.0
up

# adding route
!/sbin/route add -inet 10.1.1.0/24 10.1.1.206
!/sbin/route add -inet 172.16.17.0/24 10.1.1.206


Which works, I can ping the server at 10.1.1.206, but any variation I have tried on wgaip (for example: wgaip '10.1.1.0/24, 172.16.17.0/24') fails with :

# sh /etc/netstart      
ifconfig: wgaip: bad address

I cannot find out the appropriate syntax for wgaip to use in the hostname.if format.
I tried the man and some searching but always found a wireguard-tools syntax.

Thanks for your help,
Pierre

No comments:

Post a Comment