I use Juniper Networks (a Java program that establishes a VPN connection).
Does a command exist that lets me check if I'm logged in with Juniper?
I use Juniper Networks (a Java program that establishes a VPN connection).
Does a command exist that lets me check if I'm logged in with Juniper?
Route-based VPN or overlay network solutions (with virtual interfaces)
If you run
ifconfig -a
orip link show
you should be seeing something liketunX
below which is a tun device used by most route-based VPN:ip link
outputPolicy-based VPN (e.g. strongSwan)
Or if you are using IPsec (e.g. strongSwan),
ifconfig -a
will show a tunnel device (tunX) like below if you are using Route-based mode (default is policy-based):If strongSwan is running policy-based routing (default), you'll be able to figure out by manipulating the kernel routing table or looking at
ip-xfrm
IP framework for transforming packets (encrypting payloads).In addition, you can use
ip tuntap show
to see if there are tun/tap devices to determine if VPN is in use.You can also check your routes with the
route
command. You will see more routes as normal and to different destinations.Example
Connected without juniper:
Connected with Juniper:
In my case, the device is
cscotun0
(I use Cisco Anyconect Secure Mobility Client) rather thantun0
.Therefore (based on Terry Wang's answer and zipizap's comment), if you do not know the device name, you may use:
or, if you know the device name:
UPD With Ubuntu 18.04, I need:
Unfortunately,
ifconfig vpn0
now returns 0 (success) even if vpn is not working.Alternative solution (Gnome)
Check when it's running
Check when it's not running
so you can check for UP, RUNNING via grep as shown below
I'm using fantastic argo gnome shell plugin, and above is part of my script so I can launch VPN from toolbar (or shut it down)
Using the juniper
ncdiag
commands will give you this information.ncdiag -t
for a tunnel test.ncdiag -h
for host info.More specifics:
+==============================================================================+