Skip to content. | Skip to navigation

Navigation

You are here: Home / Support / Guides / Tools / OpenVPN / tun

Personal tools

OpenVPN

Building OpenVPN and friends.

tun

Before we can build OpenVPN we need to build tun (and possibly tap) devices on Solaris (OpenSolaris/OpenIndiana). OpenVPN recommends the TUN/TAP driver from http://vtun.sourceforge.net/tun/.

It needs a couple of tweaks:

  1. The OpenVPN README suggests a patch (http://openvpn.net/patch/tun-sb.patch) which is Linux-specific. There is a Solaris-specific patch mentioned (http://openvpn.net/solaris/tun.c) which you use to overwrite the solaris/tun.c file in its entirety.

  2. For Solaris we still need to change a few things:

    1. Blindly compiling will result in the following message in /var/adm/messages:

      genunix: [ID 399259 kern.notice] do_relocations: /usr/kernel/drv/amd64/tun do_relocate failed
      

      as the code isn't kernel-ready. Fix that by adding:

      -mcmodel=kernel
      

      to the CFLAGS line. Some blogs reference -xmodel=kernel so YMMV.

    2. For 64bit Solaris we need to change two things:

      1. Change the CFLAGS line to create a 64bit image:

        -m64
        
      2. Change where the driver is put! By default the driver is put in /usr/kernel/drv which is for 32bit drivers. Change the install line to:

        $(INSTALL) -m 644 -o root -g root tun $(DRV_DIR)/amd64
        

        amd64 is for x86 systems, use sparcv9 for SPARC.

        If you don't change where the driver is installed you'll get errors from the devfsadm -i tun command and openvpn will fail to find the /dev/tun device.

If everything has been installed correctly you should see the evidence across the system:

# grep ^tun /etc/name_to_major
tun 122
# modinfo | grep tun
203 fffffffff88b5000   5fa0  60   1  iptun (IP tunneling driver)
236 fffffffff7f6e000   4098   -   1  sppptun (PPP 4.0 tunnel module)
236 fffffffff7f6e000   4098 169   1  sppptun (PPP 4.0 tunnel driver)
252 fffffffff7f43000   1bf8 122   1  tun (TUN/TAP driver 1.1 05/14/2011)
# ls -l /dev/tun
lrwxrwxrwx   1 root     root          29 May 14 14:05 /dev/tun -> ../devices/pseudo/clone@0:tun

There will not be a tun0 interface plumbed at this point. openvpn will create tun interfaces as it needs them.

Document Actions