Don't Sleep Network Connection / VPN

If I let my computer sleep my VPN connection seems to die. Mac shows it as still being up, but nothing over the VPN works until I reconnect and disconnect.

I am happy to have a my monitors sleep, but I want my network and VPN connection to stay active.

I'm running Yosemite with a wired connection. Anyone know how I might get this to happen? I'm open to using Caffeine or something like that, but with 3x 30 inch monitors my power bill will suck if I don't let them sleep (and turning them off is annoying because all my windows get rearranged).


Solution 1:

Just put your displays to sleep in the energy saver settings (like in the picture below) and it should work.

enter image description here

Please check the answer at serverfault for the reason why the VPN-connections breaks.

Solution 2:

You might try caffeinate. It's the terminal utility that the Caffeine app runs. Running it from the terminal allows you to have more options:

caffeinate -ims can prevent system + disk + idle sleeping while still allowing your screen to sleep

man caffeinate:

Available options:

 -d      Create an assertion to prevent the display from sleeping.

 -i      Create an assertion to prevent the system from idle sleeping.

 -m      Create an assertion to prevent the disk from idle sleeping.

 -s      Create an assertion to prevent the system from sleeping. This assertion is valid only when
         system is running on AC power.

 -u      Create an assertion to declare that user is active. If the display is off, this option turns
         the display on and prevents the display from going into idle sleep. If a timeout is not spec-
         ified with '-t' option, then this assertion is taken with a default of 5 second timeout.

 -t      Specifies the timeout value in seconds for which this assertion has to be valid. The asser-
         tion is dropped after the specified timeout. Timeout value is not used when an utility is
         invoked with this command.

 -w      Waits for the process with the specified pid to exit. Once the the process exits, the asser-
         tion is also released.  This option is ignored when used with utility option.