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
      • Choose from the requirements
      • Prefer private NAT for narrow services
      • Use a shared interface for a simple LAN address
      • Use VNET for a separate network stack
      • Record the design before creation
      • Primary references

      Choose a jail network model

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

      Synopsis #

      A jail network is an architecture decision, not a creation flag. The host always remains responsible for the physical interface, routing, and firewall. The main choice is whether the jail shares the host network stack or receives an independent VNET stack.

      For a first internet-facing service, a private address with host NAT and explicit port redirection is usually the easiest model to audit. Use VNET only when the workload needs its own interfaces, routing table, DHCP, WireGuard interface, or packet-filtering context.

      Choose from the requirements #

      RequirementSuitable modelMain cost
      Outbound access with a few published portsPrivate address on bastille0, NAT, and PF redirectionThe host owns NAT and every inbound mapping
      An address on the existing LAN without a separate network stackShared or aliased host interfaceThe jail address is directly reachable wherever the LAN and host firewall permit it
      Independent routes, interfaces, DHCP, or a VPN endpointVNETBridges, epair interfaces, firewall placement, and route diagnostics become part of operations
      Attachment to an existing bridge or isolated segmentBridged VNETThe bridge must be created and persisted by the host
      Access to every host network addressInherited networkingWeak separation and port conflicts; unsuitable as the default for an exposed service

      Network isolation and filesystem isolation are different controls. VNET does not make a jail equivalent to a virtual machine, and a private address does not prevent a compromised jail from using whatever outbound traffic PF permits.

      Prefer private NAT for narrow services #

      The procedure in Create a first jail with Bastille creates a conventional jail with a private address on bastille0. Bastille adds the address to its PF table so that the host can translate outbound traffic.

      This arrangement has a useful default property: a service is not reachable through the host’s public address merely because it starts listening in the jail. Exposure requires an explicit mapping. Publish a Bastille service through PF adds that mapping after verifying the listener and firewall path.

      Choose an RFC 1918 range that does not overlap any LAN, VPN, cloud, or routed remote network. An overlap can make replies follow the wrong route even when the PF rules are correct.

      Use a shared interface for a simple LAN address #

      A classic jail can use an unused address from a subnet already attached to a host interface. Bastille adds that address as an alias. The jail shares the host network stack but is restricted to its configured addresses.

      This is simpler than VNET when the service merely needs its own LAN address. It also removes the protection provided by an unadvertised private network: LAN peers can reach the address if the firewall permits them. Confirm address ownership, ARP behavior, and upstream routing before creation.

      Use VNET for a separate network stack #

      VNET gives the jail its own interfaces, addresses, routes, and network stack. Bastille’s -V mode creates and manages a bridge and epair interfaces. Its -B mode attaches epairs to a bridge that the host already manages.

      VNET is justified for requirements such as:

      • running DHCP or routing software inside the jail;
      • terminating a VPN on an interface owned by the jail;
      • using multiple interfaces or routing tables;
      • observing or filtering traffic at a jail-specific interface boundary.

      It also creates more failure points. Record the host-side epair, jail-side interface, bridge members, default route, and the interface on which PF filters packets. Do not copy bridge filtering sysctls from another installation without first determining where filtering is intended to occur.

      Record the design before creation #

      For every jail, record:

      1. The network model and the reason it is required.
      2. The host interface or bridge involved.
      3. The jail addresses, prefix lengths, and default route.
      4. The DNS resolver source.
      5. The host PF table, NAT rule, and inbound mappings.
      6. Whether an address is reachable from the LAN, a VPN, or the public Internet.

      After creation, compare the record with actual state:

      $ ifconfig -a
      $ netstat -rn
      # bastille list jail
      # pfctl -sr
      # pfctl -sn
      

      When the path fails, follow Diagnose DNS, routing, and firewall paths from the jail outward rather than changing several layers at once.

      Primary references #

      • Bastille networking
      • FreeBSD Handbook: Jails and Containers
      • jail(8)
      • vnet(9)
      • bridge(4)

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

      Report a bug
      • Synopsis
      • Choose from the requirements
      • Prefer private NAT for narrow services
      • Use a shared interface for a simple LAN address
      • Use VNET for a separate network stack
      • Record the design before creation
      • Primary references