In case it's useful to anyone else, here's the commands I'm running to 
start/stop my VPN, without making any changes to the strongswan config, and 
work around the issues above.
Start VPN:
    sudo systemctl restart systemd-networkd.service  # to avoid the error Unit 
dbus-org.freedesktop.network1.service not found

    # Start the VPN - expect errors about assigning DNSs to the "lo" interface
    sudo swanctl -i -c child_name_goes_here

    # Get interface of default route with the lowest metric
    iface=$(ip -j route | jq -r '.[] | select(.dst == "default") | .dev + " " + 
(.metric // 1000000 | tostring)' | sort -k2 -n | head -n1 | cut -d ' ' -f1)

    # Add known name servers, eg
    sudo resolvectl dns $iface 10.0.0.1 10.0.0.2

    # Add search path
    sudo resolvectl domain $iface mydomain.com my.other.domain.com


And to stop the VPN:
    sudo swanctl -t -i child_name_goes_here

    # Get interface of default route with the lowest metric
    iface=$(ip -j route | jq -r '.[] | select(.dst == "default") | .dev + " " + 
(.metric // 1000000 | tostring)' | sort -k2 -n | head -n1 | cut -d ' ' -f1)

    # Drop the interface, in order to bring it up again and reset its 
nameservers. This takes a while
    sudo ip link set $iface down
    while sudo resolvectl dns $iface | grep -q 10.0.0.1 ; do
      echo "  waiting for $iface to go down"
      sleep 1
    done
    sudo ip link set $iface up

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2067897

Title:
  Ubuntu 24.04 does not install resolvconf uses systemd-resolved instead
  which is broken

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/2067897/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to