Automatically Simple Since 2002
11 August 2014
FreeBSD jails used to be defined in /etc/rc.conf using rc-style syntax. During FreeBSD 9.x, a new convention was introduced, using /etc/jail.conf. FreeBSD 10.x defaults to the new style but still supports the rc.conf style. FreeBSD 11 will probably drop support for the old style.
jail_enable="YES"
jail_list="81r01 91r02 91br01"
jail_mount_enable="YES"
jail_devfs_enable="YES"
jail_devfs_rules="devfsrules_jail"
jail_81r01_rootdir="/jails/81r01"
jail_81r01_hostname="es-bb81-4.therub.org"
jail_81r01_ip="172.22.131.186"
jail_91r02_rootdir="/jails/91r02"
jail_91r02_hostname="es-bb91-4.therub.org"
jail_91r02_ip="172.22.131.187"
jail_91br01_rootdir="/jails/91br01"
jail_91br01_hostname="es-bb91b-4.therub.org"
jail_91br01_ip="172.22.131.188"
While your jails are still running under the old style, have a look at /var/run/jail*.conf. Create an initial /etc/jail.conf using the generated files /var/run jail files:
$ cat /var/run/jail*.conf >> /etc/jail.conf
Remove everything from rc.conf except for the jail_enable line. If FreeBSD 9.x, change jail_enable to jail2_enable. Also, move everything shared to the global scope to clean up the individual definitions.
allow.raw_sockets = 0;
exec.clean;
exec.system_user = "root";
exec.jail_user = "root";
exec.start += "/bin/sh /etc/rc";
exec.stop = "/bin/sh /etc/rc.shutdown";
exec.consolelog = "/var/log/jail_${name}_console.log";
mount.devfs;
mount.fstab = "/etc/fstab.$name";
allow.mount;
allow.set_hostname = 0;
allow.sysvipc = 0;
path = "/jails/${name}";
81r01 {
host.hostname = "es-bb81-4.therub.org";
ip4.addr = 172.22.131.186;
}
91br01 {
host.hostname = "es-bb91b-4.therub.org";
ip4.addr = 172.22.131.188;
}
91r02 {
host.hostname = "es-bb91-4.therub.org";
ip4.addr = 172.22.131.187;
}
For reference, see jail.conf(5) and jail(8).