# [solved] wireguard setup with connman

## DeIM

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

```
[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:

```
[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 interfaceLast edited by DeIM on Tue Aug 31, 2021 9:15 am; edited 1 time in total

----------

## DeIM

I've added to connman vpn config:

```
WireGuard.SaveConfig = true
```

then:

```
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.

----------

## DeIM

OK, solved - there was an error on linked page:

The config should contain public key of server not client.

```
WireGuard.PublicKey = [server public key]
```

----------

