How to calculate a working "AllowedIPs" for Wireguard on Android?
I am using Android to connect to my WireGuard server through the public IP address of the host network. The LAN is using addresses 192.168.0.1-255
. I would like the client to connect through the VPN only to addresses with in the LAN and directly access the others. The config is as follows:
[Interface]
PrivateKey = xxx=
Address = 198.18.7.4/32
DNS = 192.168.0.1
[Peer]
PublicKey = xxx=
AllowedIPs = 192.168.0.1/24
Endpoint = my.public.IP:51820
But I am getting a "Bad Address" for whatever I tried to use except for /32
. Not being familiar with Subnet Address scheme, I tried to use the table and calculator here which seems to tell me that /24 is the correct subnet. On Windows this seems to work fine.
Any Idea what can be wrong here? Is the AllowedIPs wrong? Or is there an issue with Android that is not in my control?
Thanks!
Your AllowedIPs
setting is wrong -- it must be a proper subnet: 192.168.0.0/24
, not 192.168.0.1/24
.
(It's confusing because the Address
setting can be specified using the same notation -- eg 198.18.7.4/24
-- but in that case, it means the interface's address is 198.18.7.4
on the 198.18.7.0/24
subnet.)