Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I use Juniper Networks (a Java program that establishes a VPN connection).

Does a command line command exist that lets me check to see if I'm logged in with Juniper?

share|improve this question

3 Answers 3

up vote 5 down vote accepted

If you run ifconfig you should be seeing something like tunX below:

tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          inet addr:  P-t-P:  Mask:
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1300  Metric:1
          RX packets:10 errors:0 dropped:0 overruns:0 frame:0
          TX packets:24 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500 
          RX bytes:1435 (1.4 KB)  TX bytes:1677 (1.6 KB)
share|improve this answer
1  
Building upon Terry Wang answer, you can make use this one-liner to check it: ifconfig tun0 &> /dev/null && echo -e "\033[1;32m" "-- VPN is active --" "\033[0m" –  zipizap Nov 20 '12 at 11:53
    
@zipzap: Nice :-) –  moose Nov 20 '12 at 16:25

Using the juniper ncdiag commands will give you this information.

  • Use ncdiag -t for a tunnel test.
  • Use ncdiag -h for host info.

More specifics:

$ cd ~/.juniper_networks/network_connect
~/.juniper_networks/network_connect$ file !$
file ncdiag
ncdiag: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.2.5, stripped
~/.juniper_networks/network_connect$ ./ncdiag 
    usage: ./ncdiag -A [or]
    usage: ./ncdiag -i -s -d -t -h -a -r <hostname> -k -v
     -A : All tests
     -i : installation test 
     -s : service test 
     -d : driver tests 
     -t : tunnel test 
     -h : host info 
     -a : adaptor test 
     -r : resolve host 
     -k : kill NC gui 
     -v : version   

~/.juniper_networks/network_connect$ ./ncdiag -t
+==============================================================================+
|   Tests:          |        Results:                      |
+==============================================================================+
       o  NC Diagnostics            
             NC Tunnel Test          Established

       Finished running tests 
+==============================================================================+
~/.juniper_networks/network_connect$ ./ncdiag -h
+==============================================================================+
|   Tests:          |        Results:                      |
+==============================================================================+

   o  Host Details              
         Hostname            tau
         Domainname          (none)
         IP Routing Enabled      Yes
         IP Loopback test        Passed
         Nameserver Details     
           8.8.8.8       Ping Passed

           8.8.6.6       Ping Passed
         Gateway Ping Test           
            10.20.20.1       Ping Passed

   Finished running tests 

+==============================================================================+

share|improve this answer

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:

moose@pc07:~$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.0     *               255.255.255.0   U     2      0        0 wlan0
link-local      *               255.255.0.0     U     1000   0        0 wlan0
default         192.168.0.1     0.0.0.0         UG    0      0        0 wlan0

Connected with Juniper:

moose@pc07:~$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.1     *               255.255.255.255 UH    1      0        0 wlan0
vpn.kit.edu     192.168.0.1     255.255.255.255 UGH   1      0        0 wlan0
192.168.0.0     *               255.255.255.0   U     2      0        0 wlan0
link-local      *               255.255.0.0     U     1000   0        0 wlan0
default         vpn-cl-192-62.s 0.0.0.0         UG    1      0        0 tun0
default         192.168.0.1     0.0.0.0         UG    10     0        0 wlan0
share|improve this answer
    
This is the better answer then the accepted one, at least if you ask me :) –  Aleks Dec 17 at 8:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.