Change your macOS power settings to prevent disconnecting from VPN/Wi-Fi when the computer is locked

How to modify configuration via Terminal

1. Launch Terminal.

2. Enter the following command to change the directory: cd /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources

3. The following command prevents the wireless connection from disconnecting and to wake the device on network activity respectively: ./airport en0 prefs DisconnectOnLogout=NO ./airport en0 prefs WoWEnabled=YES

4. Lastly, the command below changes the power settings to allow the network connection to keep alive when the computer is locked: pmset -a networkoversleep 1