L2TP over IPSec VPN does not start from Script in MacOS 10.12


Aloha, this is my first question I ask here, I hope I do it in the right format. I did some research before, but could not find any answer to my problem.


OS: MacOS 10.12.6 VPN: L2TP over IPSec (Meraki MX is the VPN device)

Problem discription: I need to start the VPN in a script, because I need to setup static routes through the tunnel. When I start the VPN from GUI (System preferences) it works without any problem, but not with a bash script with the command scutil.

I tried to use this script from here: https://stackoverflow.com/questions/32957121/in-mac-os-x-10-11-opening-a-vpn-connection-window-with-the-command-line-gives-m

Answer made by: https://stackoverflow.com/users/508185/adejones

IS_CONNECTED=$(test -z `scutil --nc status "$VPN" | head -n 1 | grep Connected` && echo 0 || echo 1);
if [ $IS_CONNECTED = 1 ]; then
  scutil --nc stop "$VPN"
  scutil --nc start "$VPN"

Error: The server is unreachable. Try reconnecting. If the problem continues, verify your settings and contact your Administrator.

Any idea, what I am doing wrong? Thanks Marcel

1 Answer 1


I found the answer by myself.

I had a similar issue on macOS 10.12.6
Root cause was, that I also changed the configuration name of the VPN.

After removing the old VPN and creating a VPN with another name and configuration "Default",
it works with both the command scutil and networksetup

enter image description here

With this I can start the VPN from shell with both scutil and networksetup

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .