Archive for June, 2010

Juniper/Aventail VPN Fix for Ubuntu 10.04

June 8th, 2010 No comments

With the release of Ubuntu 10.04, the tun driver, commonly used for VPN connectivity, has been moved into the kernel, instead of being loaded as a module as it was previously. ¬†Unfortunately, the Juniper and Aventail VPN clients check for VPN support in the kernel by running a “modprobe tun”, instead of checking for the presence of the device nodes. ¬†This causes the VPN connections to immediately fail, even though they would otherwise succeed. ¬†Searching the Ubuntu forums, I happened upon this thread:

After trying a couple of the other fixes, I finally found a script, posted by cdenley ( which successfully works around the issue by creating a null driver named tun, which the VPN clients can then modprobe with no harmful results to satisfy their requirements.

#! /usr/bin/env bash
sudo apt-get install build-essential linux-headers-`uname -r`
mkdir faketun
cd faketun
echo -e "#include <linux /module.h>\nstatic int start__module(void) {return 0;}\nstatic void end__module(void){return;}\nmodule_init(start__module);\nmodule_exit(end__module);">tun.c
echo -e "obj-m += tun.o\nall:\n\tmake -C /lib/modules/\$(shell uname -r)/build/ M=\$(PWD) modules\nclean:\n\tmake -C /lib/modules/\$(shell uname -r)/build/ M=\$(PWD) clean\nclean-files := Module.symvers">Makefile
sudo install tun.ko /lib/modules/`uname -r`/kernel/net/tun.ko
sudo depmod -a
sudo modprobe tun

Categories: Linux Tags: