I am using a wildcard certificate.
I have managed to setup ikev2 protocol, applied my own certificate but it won't work for subdomains.
Is there any workaround for this or the wildcard should be of a certain format ?
Generally, strongSwan doesn't support wildcard certificates (see e.g. #794). For instance, if the server certificate contains
*.example.com as subjectAltName extension strongSwan won't match
vpn.example.com against that.
If you have multiple subdomains add a subjectAltName extension for each to the server certificate.