Closed movy closed 2 years ago
Thanks for this. I'll try to look into the behaviour on current macOS sometime.
Thanks for the follow up. After a month of testing, I'm not so certain MOBIKE is the cause for not being able to reconnect after awake, maybe it's my Airport or my provider's router, who knows. But the remedy was to forcefully disconnect VPN before wifi drops, i.e. as soon as I close Macbook lid. I just set up a simple Macro with Keyboard Maestro (I think the same can be done with some pain and tears using AppleScript) and now my VPN disconnects before wifi drops and almost instantly reconnects when Macbook is awaken.
Another very useful tool for VPN: https://github.com/Timac/VPNStatus/releases
Why won't Apple just make VPN more welcome in their OS's..
tl;dr: disabling MOBIKE (setting
DisableMOBIKE
to 1 in mobileconfig) helped me to fix the looooooong standing issue with failed-reconnection-loop whenever MacBook is awaken from sleep. This issue been bugging me (and many others) for years without any solution or fix from Apple (apart from installing 3rd party VPN apps), until I had a chance (thanks to this script) to fine-tune VPN settings myself. Just to clarify, the issue seems to be purely client-side (i.e. Apple's bug): looks like MacOS keeps the socket busy even though the connection was dropped during sleep, and all further connection attempts fail until the user manually stops VPN from re-connecting (hence releasing the socket), then the connection can be manually re-established w/o any issues. I surmise that disabling MOBIKE forces MacOS to release the socket as soon as the connection was dropped, clearing the path for an instant and painless reconnection.Btw, this "reconnection hell" does NOT happen when switching between wifi networks, and if your personal VPN server is nearby, a re-negotiation w/o MOBIKE takes half a second anyway, so not an issue really. Maybe it's worth mentioning in the FAQ or during the script install, so users can choose desired behaviour?
Maybe this bug had been fixed in recent MacOS releases, but I'm still on Mojave and not willing to upgrade just to fix this matter (considering how many other issues would pop up after such upgrade).
P.S. this script is amazing! I've been deeply annoyed by PureVPN with constant disconnects and painful reconnects under MacOS (using VPN Monitor). It always was hit-or-miss whether their VPN would reconnect successfully, or I have to accept its failure, click damned annoying "VPN was disconnected" MacOS popup, wait sometime, then try reconnecting manually again etc etc. Last night I had the last drop with it and after years of postponing finally googled "how to set up personal IKEv2 server" and ended up here. Cannot be more grateful to @jawj , fantastic job!
P.P.S can also add AWS LightSail to recommended deployment targets, as it's super easy to set up and offers 1TB of traffic on the cheapest plan ($3/mo). EC2 is less forgiving in this regard.