The Handbook

    Theme
    • Guides
        • Check a system before installing FreeBSD
        • Orient a Linux administrator on FreeBSD
        • Supported FreeBSD releases
        • Choose a FreeBSD documentation and support channel
        • Move files safely without GNU mv -t
        • Update, upgrade, or update packages?
        • Upgrade 14.4 or 15.0 to FreeBSD 15.1
        • Choose packages, ports, or poudriere
        • Choose the quarterly or latest package branch
        • Choose a FreeBSD download or package mirror
        • Make a system setting persistent
        • Configure locale, keyboard, and time zone
        • Configure a serial console for recovery
        • Choose a custom kernel, module, or loader setting
        • Run a Linux binary with the compatibility layer
        • Check desktop and laptop hardware before installation
        • Choose and check a graphics driver
        • Choose Xorg or Wayland
        • Build a maintainable desktop baseline
        • Install and check a desktop browser
        • Check laptop Wi-Fi, power, and suspend
        • Check multimedia readiness
        • Choose and configure a printing stack
        • Run Windows applications with Wine
        • Snapshot and replicate a ZFS dataset
        • Choose a filesystem and storage layout
        • Operate ZFS without losing the recovery path
        • Restore files from a ZFS snapshot
        • Read ZFS pool health and run a scrub
        • Replace a failed device in a ZFS mirror
        • Replicate a ZFS dataset over SSH
        • Change PF safely on a remote host
        • Configure a narrow WireGuard tunnel
        • Plan a FreeBSD home server
        • Choose a mail server or an outgoing relay
        • Publish a network service safely
        • Choose a jail network model
        • Choose native jails or a jail manager
        • Choose a jail or a bhyve virtual machine
        • Establish a FreeBSD security baseline
        • Choose a MAC policy
        • Audit security-relevant activity
        • Start a DTrace performance investigation
    • Integrations
        • Create a first jail with Bastille
        • Compare jail managers and OCI tooling
        • Publish a Bastille service through PF
        • Mount a ZFS dataset in a Bastille jail
        • Update and upgrade Bastille jails
        • Back up and restore a Bastille jail
        • Prepare bhyve and vm-bhyve
        • Choose NFS or Samba for file sharing
        • Choose ZFS backup automation
        • Operate a signed poudriere repository
        • Manage FreeBSD configuration with Ansible or Salt
        • Run Motion with webcamd on FreeBSD
        • Design a reverse proxy, certificates, and monitoring
    • FAQ
      • Troubleshooting
          • Recover an interrupted freebsd-update run
          • Resolve a package repository or ABI mismatch
          • Diagnose the FreeBSD boot path
          • Recover with a ZFS boot environment
          • Diagnose DNS, routing, and firewall paths
          • Diagnose network mbuf exhaustion
          • Bind a service to a low port without running it as root
          • Diagnose audio output or input
          • Diagnose webcamd, cuse, and a webcam
          • Fix USB device permissions without opening every device
      • About this handbook
      • Synopsis
      • Check the host first
      • Install and enable Bastille
      • Bootstrap a matching release
      • Create the jail
      • Manage software and services
      • Stop or remove the jail
      • Choose the next network model deliberately
      • Primary references

      Create a first jail with Bastille

      Last reviewed
      13 August 2026
      Applies to
      15.1-RELEASE, 15.0-RELEASE, 14.4-RELEASE

      Synopsis #

      Bastille manages FreeBSD jails, release files, networking, and repeatable templates. It does not replace the jail subsystem: a Bastille container is a FreeBSD jail, and the host remains responsible for its kernel, firewall, storage, and backups.

      This procedure creates a conventional private-address jail after running Bastille’s interactive setup. The setup can enable and start PF and change host networking. Use a system console or another recovery path when preparing a remote host.

      Check the host first #

      Identify the host release, interfaces, firewall state, and ZFS pools:

      $ freebsd-version -ku
      $ ifconfig -l
      # service pf status
      $ zpool list
      

      A jail cannot run a newer FreeBSD userland than its host kernel. Use the host’s release for the first jail unless a documented compatibility requirement calls for an older supported release.

      If PF already carries production rules, read those rules and the Bastille setup documentation before proceeding. Do not allow an installer to become the first time the firewall configuration is reviewed.

      Install and enable Bastille #

      Install the official FreeBSD package and enable its startup integration:

      # pkg install bastille
      # sysrc bastille_enable=YES
      

      Bastille is not a continuously running daemon. Its rc script starts and stops configured jails with the host.

      Review the installed configuration before setup:

      # less /usr/local/etc/bastille/bastille.conf
      # bastille setup
      

      The default setup creates the bastille0 loopback interface, adds PF rules for private jail addresses, prepares storage, and can enable and start PF. Bastille also supports separate bridge, vnet, firewall, and storage setup modes. Use those only after selecting the intended network model.

      After setup, confirm the resulting host state rather than assuming it succeeded:

      $ ifconfig bastille0
      # service pf status
      $ sysrc bastille_enable pf_enable
      

      Bootstrap a matching release #

      The bootstrap step downloads and verifies the release files from which jails are created. On a 15.1-RELEASE host, bootstrap 15.1 and apply its available updates:

      # bastille bootstrap 15.1-RELEASE update
      

      On a 15.0 or 14.4 host, substitute that exact release. Do not copy a newer release name onto an older host.

      List the available release after bootstrap:

      # bastille list release
      

      Create the jail #

      Choose an unused address from the private network configured by bastille setup. This example uses 10.17.89.10/24:

      # bastille create firstjail 15.1-RELEASE 10.17.89.10/24
      # bastille list jail
      

      Again, substitute the host’s supported release when it is not 15.1. Confirm the jail’s view of the release and outbound network:

      # bastille cmd firstjail freebsd-version
      # bastille cmd firstjail fetch -qo /dev/null https://www.freebsd.org/
      

      The second command verifies DNS, routing, PF, and HTTPS together. If it fails, inspect those layers separately before adding port-forwarding rules.

      Manage software and services #

      Use Bastille’s subcommands to keep the administrative boundary visible:

      # bastille pkg firstjail install nginx
      # bastille sysrc firstjail nginx_enable=YES
      # bastille service firstjail nginx start
      # bastille service firstjail nginx status
      

      This installs and starts nginx inside the jail. It does not expose port 80 outside the private network. Incoming access requires an intentional PF rule or bastille rdr mapping. Publish only the ports that the service needs.

      Use an interactive console only when a targeted subcommand is insufficient:

      # bastille console firstjail
      

      Exit the jail shell before changing its host-side network or storage configuration.

      Stop or remove the jail #

      Stopping preserves the jail and its data:

      # bastille stop firstjail
      

      bastille destroy firstjail permanently removes the jail. Confirm its datasets, mounts, templates, and backups before using that command. A ZFS snapshot on the same host does not replace an independent backup.

      Choose the next network model deliberately #

      The default private network is appropriate for learning and for services reached through explicit redirection. Other workloads may need:

      • VNET, when the jail needs its own network stack and an address on the local network;
      • bridged VNET, when an existing bridge or isolated network must be selected explicitly;
      • an alias or shared interface, when a separate network stack is unnecessary;
      • a private NAT network, when outbound access and narrowly published inbound ports are preferred.

      These modes change the host’s bridge, epair, address, routing, and firewall responsibilities. A follow-up guide will treat them as an architecture decision rather than a list of flags.

      After the first jail works, record its base and package maintenance procedure with Update and upgrade Bastille jails before it becomes a production service.

      Primary references #

      • Bastille: Getting Started
      • Bastille documentation
      • Bastille networking modes
      • Bastille automation templates
      • FreeBSD Handbook: Jails and Containers
      • jail(8)
      • pf.conf(5)

      Independent documentation. Not affiliated with or endorsed by the FreeBSD Project or the FreeBSD Foundation.

      Report a bug
      • Synopsis
      • Check the host first
      • Install and enable Bastille
      • Bootstrap a matching release
      • Create the jail
      • Manage software and services
      • Stop or remove the jail
      • Choose the next network model deliberately
      • Primary references