At last I got OpenVPN working in an iocage. Though the installation of openvpn itself with $ pkg install openvpn is straightforward, and the configuration is amply described here in the forum, the stumbling block for the iocage is always to get the tun/tap device tun0 working properly. Many people including myself tried the command -$ devfs rule -s 4 add path 'tun*' unhide. But it just does not work!!
Thanks to Brandon Schneider and Dan Jacques (see https://ftp.freenas.org/issues/40872#note-44) I finally got it OpenVPN working. This is how to do it:
1. Remove the pri-init "devfs rule....." in the old GUI of FreeNAS in case you have it there. Reboot your NAS. This to make sure that any remnants of "devfs...." are removed.
2. In the new GUI, create a new jail for OpenVPN. Make sure to include in the options VNET0, devfs_ruleset 4, and enable mount.devfs and mount.fdescfs. Check also allow.set_hostname, allow.mount and allow.mount.devfs. Click SAVE.
3. And here is the big trick (thanks again Brandon and Dan): In a jail shell, get out of the OpenVPN jail, stop it, and give the command iocage set allow_tun=1 <name of your openvpn jail>. Restart the jail.
4. Enjoy your OpenVPN in the iocage jail.
Thanks to Brandon Schneider and Dan Jacques (see https://ftp.freenas.org/issues/40872#note-44) I finally got it OpenVPN working. This is how to do it:
1. Remove the pri-init "devfs rule....." in the old GUI of FreeNAS in case you have it there. Reboot your NAS. This to make sure that any remnants of "devfs...." are removed.
2. In the new GUI, create a new jail for OpenVPN. Make sure to include in the options VNET0, devfs_ruleset 4, and enable mount.devfs and mount.fdescfs. Check also allow.set_hostname, allow.mount and allow.mount.devfs. Click SAVE.
3. And here is the big trick (thanks again Brandon and Dan): In a jail shell, get out of the OpenVPN jail, stop it, and give the command iocage set allow_tun=1 <name of your openvpn jail>. Restart the jail.
4. Enjoy your OpenVPN in the iocage jail.