Articles

Networks the host controls

How JailOps networks jails without a bridge or a DHCP server. The host hands out addresses, gives every jail a link of its own and routes between them, so jails are kept apart. What you get, what you can do and what does not pass between jails.

The idea

The host is the router.

A network in JailOps is an address range with an uplink. Every jail gets an address from the range, written into its specification, and a private link to the host. The host answers on that link as the gateway and routes everything: from a jail to the internet, from the internet to a jail, and from one jail to another.

There is no bridge to design, no DHCP server to run and nothing to configure on the host but forwarding. The host is the only thing the jails can reach directly, so the host is where you decide what they can do.

A network in one command

Then a project and a jail.

on the host
$ jailops network create office --ipv4 192.0.2.1/24 --uplink em0 --nat
$ jailops project create shop
$ jailops network grant office --project shop
$ jailops storage grant default --project shop
$ jailops create site --project shop --image freebsd-15-1 --network office --storage default --start
$ jailops network leases office

--nat translates what leaves through the uplink. jailops network leases lists who has which address. For IPv6 add a prefix: IPv6 and cloud setups.

Jails kept apart

Each jail has a link of its own.

Two jails never share a network segment, so:

  • They cannot see each other's traffic. A jail that captures packets sees its own and nobody else's.
  • They cannot poison each other. The ARP, neighbour, router advertisement and DHCP packets of a jail go no further than the host's end of its own link. A forged one changes nothing outside that jail.
  • They cannot take each other's addresses. The host routes an address to the one link of the jail that owns it, and the jail's firewall drops what it sends from another address.

An address that no jail has is never sent out of the uplink: the host answers with an error.

Letting them talk

As far as the firewall allows.

What passes between two jails is what both jails' firewall policies allow, and jailops firewall test tells you before you try it. The host is an end like any other: allow out tcp to host port 443 lets a jail reach a service on the host.

on the host
$ jailops firewall test --from jail:web --to jail:db --port 5432

More: Test the firewall before you trust it.

What does not pass

Layer 2 stays on the host.

Because jails do not share a segment, traffic that depends on one does not go from one jail to another: multicast, mDNS, VRRP and CARP, and other protocols that are not IP. Services that need to find each other use addresses or names: the jails of a project reach each other as db.shop.internal, or just db (Names for jails).

More articles

Try it on one server.

Try the console from the screenshots, install on a clean FreeBSD 15.1 machine, or add JailOps to a host you already run.