Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved] wireguard setup with connman
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
DeIM
Guru
Guru


Joined: 11 Apr 2006
Posts: 429

PostPosted: Mon Aug 23, 2021 9:37 am    Post subject: [solved] wireguard setup with connman Reply with quote

I have server with working android client VPN connection.
I tried to connect with notebook where I have connman for network management.
Connman supports wireguard but I didn't find any info about how to add/configure peer.
I've got this page: https://discourse.coreelec.org/t/one-way-of-how-to-setup-a-wireguard-vpn/12363
So I've configured this file: /var/lib/connman-vpn/wg-home.config
Code:
[provider_wireguard]
Type = WireGuard
Name = wg-home
Host = [server public IP]
Domain = [server domain]
WireGuard.Address = 10.0.1.3/24
WireGuard.PrivateKey = [client private key]
WireGuard.PublicKey = [client public key]
WireGuard.DNS = [DNS server]
WireGuard.AllowedIPs = 0.0.0.0/0
WireGuard.EndpointPort = 51820
WireGuard.PersistentKeepalive = 25


I see wg-home in services and I can connect via connmanctl it says Connected
But there is no configuration of peer in connman (which is for this side server) so it doesn't connect and there is no traffic in wg command

I've also tried standard WG configuration:
Code:
[Interface]
PrivateKey = [client private key]
Address = 10.0.1.3/24
DNS = [DNS server]

[Peer]
PublicKey = [server public key]
AllowedIPs = 0.0.0.0/0
Endpoint = [server public IP]:51820


wg-quick up with this config file connects fine but doesn't replace default route and routes only 10.0.1.0 over wg interface


Last edited by DeIM on Tue Aug 31, 2021 9:15 am; edited 1 time in total
Back to top
View user's profile Send private message
DeIM
Guru
Guru


Joined: 11 Apr 2006
Posts: 429

PostPosted: Tue Aug 31, 2021 8:28 am    Post subject: Reply with quote

I've added to connman vpn config:
Code:
WireGuard.SaveConfig = true

then:
Code:
wg set wg0 peer [server public key]  allowed-ips 0.0.0.0/0 endpoint [server public IP]:51820

It connected to server ok, wg command shows traffic.
But after disconnect and reconnect peer is not saved.
Back to top
View user's profile Send private message
DeIM
Guru
Guru


Joined: 11 Apr 2006
Posts: 429

PostPosted: Tue Aug 31, 2021 9:18 am    Post subject: Reply with quote

OK, solved - there was an error on linked page:
The config should contain public key of server not client.
Code:
WireGuard.PublicKey = [server public key]
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum