Freebsd jail setup: thick jail

From wikinotes

A Thick jail is a totally separate FreeBSD install.
It can be running a differrent release from the host, and any of the other jails.

Setup Methods

Download Releases

This approach is my favourite, since it lets you download binaries for target releases.

See for available releases: ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/amd64

Download/Extract release

fetch ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/amd64/12.1-RELEASE/base.txz  -o /tmp/base.txz
fetch ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/amd64/12.1-RELEASE/lib32.txz -o /tmp/lib32.txz
fetch ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/amd64/12.1-RELEASE/ports.txz -o /tmp/ports.txz

tar -xvf /tmp/base.txz  -C /usr/local/jails/testjail/filesystem
tar -xvf /tmp/lib32.txz -C /usr/local/jails/testjail/filesystem
tar -xvf /tmp/ports.txz -C /usr/local/jails/testjail/filesystem

Update/Verify baseinstall

env UNAME_r=12.1-RELEASE freebsd-update -b /usr/local/jails/testjail/filesystem fetch install
env UNAME_r=12.1-RELEASE freebsd-update -b /usr/local/jails/testjail/filesystem IDS

Configure Inside of Jail

cp /etc/resolv.conf /usr/local/jails/testjail/filesystem/etc/resolv.conf
echo hostname=\"fulljail1\" > /usr/local/jails/testjail/filesystem/etc/rc.conf

/etc/jail.conf

# vim: ft=conf
exec.start = "/bin/sh /etc/rc";
exec.stop = "/bin/sh /etc/rc.shutdown";
path = "/usr/local/jails/${host.hostname}/filesystem";


testjail {
    mount.devfs;
    host.hostname = "testjail";
    interface     = "em0";
    ip4.addr     = "192.168.1.240";
}

/etc/rc.conf


# /etc/rc.conf
jail_enable="YES"
jail_set_hostname_allow="NO"
jail_list="jail1 jail2 jail3 ..."  # determines which jails start at boot