Suppose that I have multiple VPN connections configured in System Preferences/Network.

How do I tell if a particular one (identified by the service name in System Preferences/Network) is up, on the command line in OS X Mavericks?

  • 2
    "Netstat -i" will do it – Ruskes Sep 16 '14 at 2:45
  • netstat -i shows the interface name, which is just ppp0, not the service name as seen in System Preferences/Network. – Kal Sep 16 '14 at 3:16
  • you mean the SSID ? – Ruskes Sep 16 '14 at 4:46
  • use the "airport -I" for that, it will list the SSID name – Ruskes Sep 16 '14 at 4:51
  • 3
    system_profiler -nospawn SPNetworkDataType Will list interfaces. If You add -xml it'll be printed in XML format, so that You can parse it. – Mateusz Szlosek Sep 16 '14 at 9:48

If you know the network address range, you could use "ifconfig" and parse the output to see if an interface is up and running with an IP in the appropriate range.

  • That's actually what I would like to avoid. Given that the IP address is assigned by the VPN server, relying on an address range would not be the most reliable way. – Kal Sep 18 '14 at 3:03

You must log in to answer this question.

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