12
3
How can I tell if OS X is connected to a VPN network from the command line?
By running ifconfig
without any arguments when I am connected, I see that there is a utun0
interface which appears to be the VPN connection. When I disconnect it goes away.
I believe I could use something like this to check for the string utun0
and count the occurrences:
ifconfig | grep -c utun0
But is there an easier or more effective way to check for this? If utun0
is a device, or even a pseudo device, shouldn't I be able to check if it exists with something like:
if [ -a '/dev/utun0' ]
Unfortunately I don't see any changes in that directory when connecting and disconnecting, I just see /dev/tun0
through /dev/tun15
and I can't cat
them even with sudo
...
Is there a simpler way to tell if I have a VPN connection?
What kind of VPN? The built-in you configure in System Preferences? – Daniel Beck – 2013-05-07T05:12:00.697
@DanielBeck -yes – cwd – 2013-05-07T18:55:54.160