mirror of
https://github.com/hwdsl2/docker-ipsec-vpn-server.git
synced 2026-04-27 10:35:53 +03:00
[GH-ISSUE #330] Unable to connect via IKEv2 #308
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ejhsu on GitHub (Nov 30, 2022).
Original GitHub issue: https://github.com/hwdsl2/docker-ipsec-vpn-server/issues/330
Checklist
Describe the issue
After following the instructions at Start the IPsec VPN server, the server can be run successfully and could be connected via L2TP/IPSec PSK mode on my Mac.
But it cannot be connected via IKEv2 mode on Mac and Android.
To Reproduce
0. Prepare vpn.env file with content
Expected behavior
VPN Connected
Logs
Server Logs
connecting on Mac
connecting on Android
Server
Client
Device#1
Device#2
Are there mismatches between cipher suites accepted by server and specified in client config file or something?
Thanks!
@hwdsl2 commented on GitHub (Nov 30, 2022):
@ejhsu Hello! Thanks for reporting this issue with details. Your issue is similar to #323. The "no suitable connection" error typically means that either the IKEv2 connection did not load successfully at Libreswan startup, or it could be that Libreswan listens to an IP address that is NOT where the connection request came from. The latter is less likely.
It looks like you already enabled Libreswan logs:
https://github.com/hwdsl2/docker-ipsec-vpn-server/blob/master/docs/advanced-usage.md#enable-libreswan-logs
Restart the Docker container
docker restart ipsec-vpn-server, then check the logs again. See if there is a specific error in the logs why the IKEv2 connection did not load.You can also run:
docker exec -it ipsec-vpn-server ipsec status
Check if the output contains 3 loaded connections. "ikev2-cp" is the IKEv2 connection.
@ejhsu commented on GitHub (Nov 30, 2022):
Thanks for your reply.
After restarting the container and investigating the log at /var/log/auth.log, I found the line with IKEv2 error:
Seems that it's failed to load IKEv2 connection, but I'm not sure how to fix it.
Updated:
Given the error message, I found the related previous issue https://github.com/hwdsl2/docker-ipsec-vpn-server/issues/199#issuecomment-652821751
Following the instructions in the comment, I can connect to the server via IKEv2 now.
Thanks @hwdsl2!
@hwdsl2 commented on GitHub (Nov 30, 2022):
@ejhsu The root cause for this issue is that MOBIKE was enabled (by the IKEv2 script) in the container, but your Docker host's kernel does not support MOBIKE. The fix is straightforward:
First, open a Bash shell inside the Docker container, and install the
nanoeditor. Instructions at:https://github.com/hwdsl2/docker-ipsec-vpn-server/blob/master/docs/advanced-usage.md#bash-shell-inside-container
After that, edit
/etc/ipsec.d/ikev2.confinside the Docker container:Find the line
mobike=yesand replaceyeswithno. Then exit the Bash shell and restart the Docker container. You will find that the IKEv2 connection now loads successfully.What is your Docker host's Linux kernel? Check using
uname -aand post the output here. I'd like to add a fix in the IKEv2 script to prevent this issue on this OS for future users.@hwdsl2 commented on GitHub (Nov 30, 2022):
@ejhsu Thanks for the update. Please post here your Docker host's Linux kernel version. Check using
uname -a. I'd like to add a fix in the IKEv2 script to prevent this issue on this OS for future users.@ejhsu commented on GitHub (Nov 30, 2022):
The Docker host information and Linux kernal version lists below:
uname -a:Linux 45d27ece040a 5.15.65+ #1 SMP Thu Nov 10 10:13:28 UTC 2022 x86_64 GNU/Linux