VPN on Ubuntu Linux with Juniper Network Connect
There’s one standard document on HOWTO get Network Connect working on Ubuntu Linux. It’s mad scientist’s doc: http://mad-scientist.us/juniper.html . However, there are a few things not covered. I’ll assume that you’ve followed mad scientist’s excellent guide before going any further.
Issue #1: 64-bit Ubuntu
By default, when you install java on your 64-bit system, you get a 64-bit java. No surprise there, right? Well, Juniper’s tools don’t play nice with 64-bit java. If you attempt to start the junipernc script you’ll promptly see the “VPN has failed!” error message.

VPN has failed!
Also if you look closely in your Terminal you’ll see the text error:
Failed to load the ncui library.
This is the clue that we are dealing with the 64-bit issue.
The work around for this is to install a 32-bit java on your system. Type the following into your Terminal:
sudo apt-get install ia32-sun-java6-bin
After typing your password, a 32-bit copy of java will be installed at: /usr/lib/jvm/ia32-java-6-sun .
Now, you need to convince Juniper Network Connect to use the 32-bit java. If you don’t use java for much besides your new VPN, you may just want to make the 32-bit java your default. This can be done by typing the following into your Terminal:
update-alternatives --set java /usr/lib/jvm/ia32-java-6-sun/jre/bin/java
If you DO use java and just want to tell the VPN to use the 32-bit java, you should modify the junipernc by adding the following line right after the block of lines that start with “#”:
export JDK_HOME=/usr/lib/jvm/ia32-java-6-sun
Now, when you run junipernc, it will use 32-bit java and you should no longer have the failure due to ncui.
Issue #2: Determining Your Realm
The scripting for Network Connect asks a few questions that may not make sense to a typical user. Even a networking savvy programmer may not be certain what values to use for the “Realm” or “PIN + SecureID Code”.
Finding your realm is fairly straight forward if you don’t mind diving into some HTML. Point your web browser to your company’s VPN website: https://vpn.mycompany.com or https://connect.mycompany.com . View the source of that page and look for a line like:
<input type="hidden" name="realm" value="REALMNAME">
The value of REALMNAME is what you’ll need to enter when prompted. Your IT department may or may not know what this is if you ask them.
If you don’t know your “PIN + SecureID Code”, it’s simply the password you type along with your username on the VPN website to gain access. As mad scientist says, some companies use “SecurID so [they] enter a personal PIN plus the value provided by the SecurID fob,” which explains why he coded that as the prompt for the password input.
If you need help, there’s a long running thread over at the ubuntu forums where this continues to be discussed a lot: http://ubuntuforums.org/showthread.php?t=232607 . I gathered my info from both mad scientist’s page above and the thread itself.
One further note, I’ve tested this on Ubuntu 9.04 64-bit as well as 8.10 32-bit. Hope this is helpful to all you who need Juniper VPN access on 64-bit Ubuntu Linux.
Comments
Comment from nate
Time: June 17, 2009, 11:17 pm
Thanks, the 64 bit hint really helped. But one thing I can’t figure out – I get asked on the web for both a password and a securID code. All the combinations I’ve tried (PW+id, PWid, PW:id, idPW, …) fail. Any ideas? This has come up in the ubuntu forum too http://ubuntuforums.org/printthread.php?t=232607&pp=75&page=4
Comment from benjamin
Time: June 18, 2009, 8:39 am
Interesting… so, you get 3 prompts when you login on the web: username, password, and secureID code. Do you also get those same prompts if you use the OS X or Windows VPN client?
I’m curious because the underlying Linux program which actually sets up the VPN tunnel ( ncsrv ) only has one password argument, so it seems that sum combination would have to work. Sadly I can’t provide more help as I can only test on my work VPN where we don’t have a separate field. Best of luck, and please post again if you figure it out. Also, I’m hoping to improve the “junipernc” shell script so that it has a more complete “nogui” mode if that would be of interest to you, though it wouldn’t help with your immediate problem.
Comment from nate
Time: June 18, 2009, 10:02 pm
Yeah, there are three prompts on the web or on the osx client, just like you said. And the lack of other options for the ncsrv script is really puzzling…
Comment from Josh Hardman
Time: July 11, 2009, 3:54 pm
Thanks for the info! I ended up getting mine to work without installing 32 bit java. Here’s my post on how to:
Comment from benjamin
Time: July 11, 2009, 4:02 pm
Glad to be of help. You are correct, the 32-bit java is only required if you wish to use the GUI.
Comment from bhaskar
Time: July 17, 2009, 6:20 pm
A big big thank you!!! After hours of googling…..yours was the one post that solved it…..THANK YOU…..
Comment from benjamin
Time: July 21, 2009, 2:17 pm
Very glad I could be of help to you!
Comment from Sriraman
Time: July 23, 2009, 10:31 am
Thanks for your effort and time!
Comment from Austin
Time: September 6, 2009, 4:10 pm
Thank you so much Benjamin! Thanks to your post I finally have Juniper Network Connect working!
I thought I should add something I determined about Issue #2, the Realm. On my university’s VPN webpage, we have a dropdown list labeled “Home Folder Server.” It turns out that this is, in fact, the realm. Looking around on the internet, it looks like some folks see “Realm” or something different, but no matter the label, the item in the dropdown is probably your realm. Since it’s a dropdown, the html code doesn’t look like you have in your post, rather, it looks like:
First Realm
Second Realm
In this example there are two realms: realm1 and realm2.
Another tip I found is to launch the program with the command nohup:
nohup /home/austin/bin/junipernc
This lets you close the terminal window without killing the actual network connect program. I’ve actually made an entry in my application list that runs this command, so I don’t have any other windows besides the Java one.
Thanks again, and I hope this comment helps someone!
Comment from Austin
Time: September 6, 2009, 4:15 pm
Okay, it erased the HTML code I had for the dropdown example. Here it is again, with replaced by ). Hopefully it will post this time:
(select size=”1″ name=”realm”)
(option value=”realm1″)First Realm(/option)
(option value=”realm2″)Second Realm(/option)
(/select)
In this example there are two realms: realm1 and realm2.
Comment from Matt Park
Time: September 10, 2009, 4:41 pm
Benjamin,
I’m running Ubuntu 9.04 x64 as a Sun VirtualBox Guest under a Windows 7 Host. I can get Network Connect to work under Windows 7, but VirtualBox does not successfully pass the traffic through the VPN. I followed the instructions here and on the mad-scientist.us page and also read a lot on the ubuntu forums and I finally got the app to come up. However, I immediately get “unable to connect to IVE” and the connection never succeeds. Nothing is ever easy. I’ve got no clue what IVE is. Can you shed any light on the subject? I though I saw the solution somewhere, but couldn’t find it when I actually got the error.
Comment from Yinon
Time: October 12, 2009, 1:15 pm
Matt, did you start it the first time by browsing to your company’s site by opera browser ? (has Java capabilities built-in) ?
Comment from Ashok
Time: December 19, 2009, 11:27 am
great … I got this to work with Karmic Koala 64 bit as well…. cheers
Ashok

Pingback from Juniper VPN with 64-bit Ubuntu | Notes & Commentary
Time: June 16, 2009, 8:48 am
[...] Sherman just put up an awesome post about how to get Juniper VPN working on 64-bit Ubuntu. I’m working remotely for the next 3 ish weeks, so this has saved me. I had been using my [...]