ConnMan VPN breaks routing on disconnect and leaks DNS while connected

  • Hello,

    I was playing around with LE 12.2/13.0 on my rpi5 (latest nightlies to make sure)

    Configuring WireGuard I discovered the following issues:

    1. Routing breaks:
      Connecting the VPN removes the default route and disconnecting doesn’t restore it.
      The VPN endpoint route is left behind. My initial guess is that the wrong route is removed.
    2. DNS-leak
      While VPN is connected, assuming at least 1 nameserver is present in /etc/resolv.conf from eth/wlan/cell.
      The original nameserver remains the first nameserver, ahead of WireGuard’s DNS.
      DNS queries bypass WireGuard's DNS and go to original nameserver causing DNS-leak.
    3. ConnMan does not come with split-dns (like dnsmasq or systemd-resolved)
      eg to provide a way to direct local-domain lookups to the local DNS
      server while sending other lookups to WireGuard’s DNS.

      This leaves a choice between DNS queries bypassing the VPN (dnsleak)
      or losing local name resolution.


    That's it I guess for my first post :/


    PS:

    Code
    The ConnMan main.conf man page documents it under [General] → ResolvConf=string. 
    It explicitly says: “If you do not want to update resolv.conf, you can set /dev/null.”
  • I can confirm all three points on LE 13 nightlies, and this is not a config error on your side. Notes per point:

    1) Routing
    The WireGuard provisioned service sorts above eth/wlan as the newest ConnMan service and
    takes over the default route, and the teardown path doesn't reliably restore it while the
    endpoint /32 route is left behind. Same class of behaviour has been reported for years,
    so it's longstanding ConnMan behaviour, not a regression in recent nightlies.

    The practical fix is to never enter that fight at all: instead of

    WireGuard.AllowedIPs = 0.0.0.0/0 use

    WireGuard.AllowedIPs = 0.0.0.0/1, 128.0.0.0/1

    By Longest Prefix Match the two /1 buckets cover the entire IPv4 space but never touch the
    eth0 default route, so ConnMan's routing logic stays intact: no route to remove on
    connect, nothing to restore (or fail to restore) on disconnect, and local /24 LAN
    traffic (Samba, SSH) still beats the /1s by definition. Full write-up here:

    WireGuard Dual Bucket Routing Optimization
    Multi-Provider WireGuard VPN Manager for LibreELEC (NordVPN, PIA, Mullvad, Proton, Custom) - BrodjagaRatnik/service.wireguard.manager
    github.com

    2) DNS
    Confirmed. ConnMan concatenates nameservers per service with no precedence control, so
    the original resolver stays first and queries leak past the tunnel. Note LE deliberately
    doesn't run ConnMan's built-in DNS proxy (127.0.0.1), because Kodi's GUI would then show
    that as "the system DNS" and generate misleading support reports. The ResolvConf=/dev/null
    option from the man page works but then nothing ever updates resolv.conf, which defeats
    the purpose on DHCP. The robust fix is enforcement at the firewall instead of resolver
    order, e.g. while the tunnel is up:

    Shell session
    iptables -I OUTPUT ! -o wg0 -p udp --dport 53 -j REJECT
    iptables -I OUTPUT ! -o wg0 -p tcp --dport 53 -j REJECT

    Note — real-world leak verification:
    A geo-restricted BBC iPlayer stream is effectively the best canary you have. iPlayer checks
    both the connection IP and (typically) DNS origin; if even one resolver or one IPv6 route
    bypassed the tunnel, you would hit the geo-wall instead of streaming. Streaming successfully
    means end-to-end correctness: DNS goes through the tunnel, traffic goes through the tunnel,
    and there is no native IPv6 path circumventing it. Combined with the provider's own leak
    test (which audits both IPv4 and IPv6 resolvers), this is double evidence that the setup
    does not leak — practical confirmation beyond what resolv.conf inspection alone shows.

    3) Split DNS
    Correct — ConnMan has nothing comparable to systemd-resolved or dnsmasq split-DNS, and
    LE ships neither. Your two options are indeed leaks, or lose local name resolution while
    the tunnel is up.

    Point 1 and 2 are worth reporting upstream at [email protected], ideally with
    `ip route show table all` and resolv.conf before/after connect/disconnect.


    If anyone runs into the same issue, the WireGuard Manager addon for LibreELEC

    https://github.com/BrodjagaRatnik/service.wireguard.manager already works around

    these behaviours, and a firewall-enforced killswitch for the DNS side.

    Edited 3 times, last by Doemela (November 14, 2026 at 5:23 PM).