Android: Howto autoload a kernel module

On my phone, I have a tun module for openvpn that i would like to autoload on boot. As it took me a while to figure out how to do this, here is how it works:

su
cd /etc/init.d
## pwd will show you that you are in /system/etc/init.d!!!
## That's what confused me.
mount -o remount,rw /system
vi 99tunmodule

The content of the file /system/etc/init.d with the right path to your tun.ko file:

insmod /system/lib/modules/tun.ko

After this execute

chown root:shell 99tunmodule
chmod 750 99tunmodule
mount -o remount,ro /system

Reboot your phone and execute lsmod to see the tun module!