Compiling a custom FreeBSD kernel to enable VNET support for jails
One issue I had while replacing FreeNAS with FreeBSD was that, by defualt, vnet support isn’t enabled in the kernel. To resolve this, I compiled a custom kernel as follows:
Step 1 - download the kernel sources
Change the FreeBSD version, as appropriate.
pkg install subversion
svn checkout http://svn.freebsd.org/base/release/10.2.0/ /usr/src
Step 2 - create a custom config
cd /usr/src/sys/amd64/conf # Replace amd64 with the desired architecture
cp GENERIC MYKERNEL
Once you’ve got a copy of the generic kernel configuration (MYKERNEL
), make any required changes. In my case, I added the following, as per the instructions on the iocage README:
options VIMAGE # VNET/Vimage support
options RACCT # Resource containers
options RCTL # same as above
Step 3 - build and install the kernel
cd /usr/src
make buildkernel KERNCONF=MYKERNEL
make installkernel KERNCONF=MYKERNEL
Let me know if you have any questions or… more importantly, if there’s an easier way of doing this!
Sources
Thanks to: