Inspect jails
jls
service jail status || true- jls shows active jail state.
Understand FreeBSD jails, create a basic jail and reason about host/jail boundaries before advanced VNET designs.
Jails provide a separate process namespace, hostname context and constrained system view while sharing the FreeBSD kernel. They are an operating-system isolation primitive, not virtual machines.
Simple jails can share host networking in constrained ways; VNET jails can receive their own network stack and interfaces. Fundamentals should master lifecycle and boundaries before advanced topologies.
jls
service jail status || trueGoal: Build a matching-release jail userland, configure it, start it, enter it with jexec, prove isolation, stop it and clean up.
RELEASE=$(freebsd-version -u | sed -E 's/-p[0-9]+$//')
ARCH=$(uname -m)
echo "$RELEASE"
echo "$ARCH"
mkdir -p /usr/local/jails/media
mkdir -p /usr/local/jails/containers/academyjail
mkdir -p /etc/jail.conf.dfetch -o "/usr/local/jails/media/${RELEASE}-base.txz" \
"https://download.freebsd.org/releases/${ARCH}/${ARCH}/${RELEASE}/base.txz"
ls -lh "/usr/local/jails/media/${RELEASE}-base.txz"
tar -xf "/usr/local/jails/media/${RELEASE}-base.txz" \
-C /usr/local/jails/containers/academyjail --unlink
ls /usr/local/jails/containers/academyjailcp /etc/resolv.conf /usr/local/jails/containers/academyjail/etc/resolv.conf
test -f /etc/localtime && cp /etc/localtime /usr/local/jails/containers/academyjail/etc/localtime || truecat > /etc/jail.conf.d/academyjail.conf <<'EOF'
academyjail {
host.hostname = "academyjail";
path = "/usr/local/jails/containers/academyjail";
exec.clean;
mount.devfs;
ip4 = inherit;
exec.start = "/bin/sh /etc/rc";
exec.stop = "/bin/sh /etc/rc.shutdown";
}
EOF
cat /etc/jail.conf.d/academyjail.confjls
service jail onestart academyjail
jlsjexec academyjail /bin/sh
# Inside the jail run:
hostname
id
freebsd-version
echo "GNU Group jail validation" > /tmp/academy.txt
cat /tmp/academy.txt
# Then exit the jail shell.cat /usr/local/jails/containers/academyjail/tmp/academy.txt
jexec academyjail hostname
jexec academyjail id
jexec academyjail freebsd-versionservice jail onestop academyjail
jls
mount | grep academyjail || true
rm -f /etc/jail.conf.d/academyjail.conf
rm -rf /usr/local/jails/containers/academyjail
rm -f "/usr/local/jails/media/${RELEASE}-base.txz"A credible jail lesson must exercise the lifecycle and host/jail boundary, not merely create directories or discuss syntax.
Open each answer only after you have tried to answer the question yourself.
No. Jails share the host FreeBSD kernel while isolating userspace views and resources.
jls.
A jail networking mode that gives the jail its own virtual network stack and interfaces.
Progress is saved in this browser immediately. When you sign in to My Learning, it can also sync across devices.
Attempt the core lab and knowledge checks before marking the module complete.