I have not managed to get VPN working since upgrading from Ubuntu 22.04 to Ubuntu 24.04. All the algorithms set and IPsec tunnel to L2TP host enabled. PAP as authentication methods selected. Everything is similar to configs used in 22.04, but it's not working.
2024-05-15T13:04:48.427386+03:00 hp-local systemd[1]: Started ipsec.service - Internet Key Exchange (IKE) Protocol Daemon for IPsec.
2024-05-15T13:04:48.434936+03:00 hp-local NetworkManager[197075]: 002 listening for IKE messages
2024-05-15T13:04:48.435006+03:00 hp-local NetworkManager[197075]: 002 forgetting secrets
2024-05-15T13:04:48.435046+03:00 hp-local NetworkManager[197075]: 002 loading secrets from "<path-to-secrets>"
2024-05-15T13:04:48.435097+03:00 hp-local NetworkManager[197075]: 002 loading secrets from "<path-to-secrets-file>"
2024-05-15T13:04:48.440326+03:00 hp-local NetworkManager[197081]: debugging mode enabled
2024-05-15T13:04:48.440395+03:00 hp-local NetworkManager[197081]: end of file <path-to-ipsec-conf>
2024-05-15T13:04:48.440426+03:00 hp-local NetworkManager[197081]: Loading conn <unique-identifier>
2024-05-15T13:04:48.440884+03:00 hp-local NetworkManager[197081]: conn: "<unique-identifier>" modecfgdns=<unset>
2024-05-15T13:04:48.440914+03:00 hp-local NetworkManager[197081]: conn: "<unique-identifier>" modecfgdomains=<unset>
2024-05-15T13:04:48.440940+03:00 hp-local NetworkManager[197081]: conn: "<unique-identifier>" modecfgbanner=<unset>
2024-05-15T13:04:48.440984+03:00 hp-local NetworkManager[197081]: conn: "<unique-identifier>" mark=<unset>
2024-05-15T13:04:48.441007+03:00 hp-local NetworkManager[197081]: conn: "<unique-identifier>" mark-in=<unset>
2024-05-15T13:04:48.441030+03:00 hp-local NetworkManager[197081]: conn: "<unique-identifier>" mark-out=<unset>
2024-05-15T13:04:48.441115+03:00 hp-local NetworkManager[197081]: conn: "<unique-identifier>" vti_iface=<unset>
2024-05-15T13:04:48.441145+03:00 hp-local NetworkManager[197081]: conn: "<unique-identifier>" redirect-to=<unset>
2024-05-15T13:04:48.441173+03:00 hp-local NetworkManager[197081]: conn: "<unique-identifier>" accept-redirect-to=<unset>
2024-05-15T13:04:48.441210+03:00 hp-local NetworkManager[197081]: conn: "<unique-identifier>" esp=aes128-sha1,3des-sha1!
2024-05-15T13:04:48.441245+03:00 hp-local NetworkManager[197081]: conn: "<unique-identifier>" ike=aes256-sha2_256-modp2048,aes256-sha2_256-modp1536,aes256-sha1-modp2048,aes256-sha1-modp1536,aes128-sha1-ecp256,3des-sha1-modp2048
2024-05-15T13:04:48.441274+03:00 hp-local NetworkManager[197081]: opening file: <path-to-ipsec-conf>
2024-05-15T13:04:48.441303+03:00 hp-local NetworkManager[197081]: loading named conns: <unique-identifier>
2024-05-15T13:04:48.441328+03:00 hp-local NetworkManager[197081]: resolving family=IPv4 src=(null) gateway=<not-set> peer <IP-Address-Redacted>
2024-05-15T13:04:48.441354+03:00 hp-local NetworkManager[197081]: seeking NOTHING
2024-05-15T13:04:48.441379+03:00 hp-local NetworkManager[197081]: resolving family=IPv4 src=<IP-Address-Redacted> gateway=<not-set> peer (null)
2024-05-15T13:04:48.441402+03:00 hp-local NetworkManager[197081]: seeking NOTHING
2024-05-15T13:04:48.441516+03:00 hp-local nm-l2tp-service[196756]: Could not establish IPsec connection.
2024-05-15T13:04:48.441577+03:00 hp-local nm-l2tp-service[196756]: g_dbus_method_invocation_take_error: assertion 'error != NULL' failed
!
) seems to be for strongswan, but the Phase 1 seems to be for libreswan as it doesn't havemodp1024
and doesn't have an exclamation mark. Anyway, phase 1 (i.e. Main Mode) seems to be failing. You could try deleting whatever you set for phase 1 & 2 and trying again. If it needs modp1024, you'll need to use strongswan as the libreswan that ships with 24.04 doesn't support it. You can also try newer package from launchpad.net/~nm-l2tp/+archive/ubuntu/network-manager-l2tpsudo apt install xl2tpd
sudo apt purge go-l2tp
which helped in my case