xref: /freebsd/share/examples/jails/README (revision d6b92ffa)
1# $FreeBSD$
2
3The below 4 samples require a VIMAGE enabled kernel:
4
5	# (as root)
6	$ cp VIMAGE /usr/src/sys/amd64/conf/
7	$ cd /usr/src
8	$ make KERNCONF=VIMAGE kernel
9	$ reboot
10
11Sample 1: jail.conf(5)
12
13	$ cp jib jng /usr/sbin/
14	$ cat jail.xxx.conf >> /etc/jail.conf
15	$ vi /etc/jail.conf
16	# NB: Customize root directory and bridge interface
17	$ sysrc jail_enable=YES
18	# NB: Assumes jail_list="" (meaning ``all jails in jail.conf'')
19	# NB: Assumes rc_conf_files="" (``below rc.conf(5) samples not used'')
20	$ service jail start
21
22Sample 2: rc.conf(5)
23
24	$ cp jib jng /usr/sbin/
25	$ cp rc.conf.jails /etc/
26	$ vi /etc/rc.conf.jails
27	# NB: Customize root directory and bridge interface
28	$ sysrc rc_conf_files+=/etc/rc.conf.jails
29	# NB: Assumes /etc/jail.conf does not exist and jail_list=""
30	$ service jail start
31
32Sample 3: Per-jail jail.conf(5)
33
34	$ cp jib jng /usr/sbin/
35	$ cp jail.xxx.conf /etc/
36	$ vi /etc/jail.xxx.conf
37	# NB: Customize root directory and bridge interface
38	$ sysrc jail_enable=YES
39	$ sysrc jail_list+=xxx
40	# NB: Assumes rc_conf_files=""
41	$ service jail start
42
43Sample 4: Per-jail rc.conf(5)
44
45	$ cp jib jng /usr/sbin/
46	$ cp rcjail.xxx.conf /etc/
47	$ vi /etc/rcjail.xxx.conf
48	# NB: Customize root directory and bridge interface
49	$ sysrc jail_enable=YES
50	$ sysrc jail_list+=xxx
51	$ sysrc rc_conf_files+=/etc/rcjail.xxx.conf
52	# NB: Assumes neither /etc/jail.conf nor /etc/jail.xxx.conf exist
53	$ service jail start
54
55For additional recipes, see share/examples/netgraph for
56making and hooking together jails using netgraph as the
57virtual networking fabric.
58