Open main menu

Gobblerpedia β

VPN

Command Line

These instructions were pieced together from the relevant VT4Help instructions and a guide found by searching for "Connecting to a Juniper VPN via the command-line in Debian" (I am unable to create pages with external links at this time).

Note that you will not need JRE installed as the vt4help instructions suggest, but you will need the 32bit glibz and zlib libraries, on a yum-based system:

   # yum install glibc.i686 zlib.i686
  1. Create a directory to store the juniper VPN utilities

            $ juniper_path=$HOME/.juniper_networks/network_connect
            $ mkdir -p $juniper_path
    
  2. Log on to the Web page with your credentials.
    1. In a Web browser, go to the https:// ras.cns.vt.edu/dana-cached/nc/ncLinuxApp.jar Web page.
    2. In the Virginia Tech PID text box, type your PID.
    3. In the Network Password text box, type your network password.
    4. Click the Sign In button.
  3. Download and save the ncLinuxApp.jar file to your computer.
  4. When the download is complete, unpackage the ncLinuxApp.jar file.

    $ unzip ncLinuxApp.jar -d ${juniper_path}
    $ sudo chown root:root ${juniper_path}/ncsvc
    $ sudo chmod 6711 ${juniper_path}/ncsvc
    $ chmod 744 ${juniper_path}/ncdiag
  5. Get the certificate for ras.cns.vt.edu

       $ bash ${juniper_path}/getx509certificate.sh ras.cns.vt.edu ${juniper_path}/ras.cns.vt.edu.der
    
  6. Create a script similar to the following

        #!/usr/bin/bash
    
        realm_host=ras.cns.vt.edu                                                                                                                          
        realm="RAS-Public" #  or "RemoteAccessUser"
        vtpid="Your VT PID"                                                                                                            
        juniper_path=$HOME/.juniper_networks/network_connect                                                                                            
                                                                                                                                                       
        sudo ${juniper_path}/ncsvc -h ${realm_host} -u ${vtpid} -f ${juniper_path}/${realm_host}.der -r ${realm} -U https://${realm_host}

    Invoke your script to connect to the VPN!

Note, the 4help instructions indicate to use the realm `"RemoteAccessUser"` to send only VT traffic over the VPN and `"RAS-Public"` to send all traffic over the VPN. So far I have only been able to work with the `"RAS-Public"` realm but I have not done extensive testing to figure out why other one didn't seem to work.