Roland's homepage

My random knot in the Web

Using the rc scripts to start a virtual server in a jail

In the previous item, we saw how to build, start and stop a jail. The rc scripts allow us to easily start and stop a jail.

Starting the jail (from the host):

slackbox# /etc/rc.d/jail onestart server
Configuring jails:.
Starting jails: server.erewhon.net.

Then log into the jail via ssh;

slackbox# ssh 192.168.0.100

Closing the jail (again from the host);

slackbox# /etc/rc.d/jail onestop server

For this to work, the following has to be set in /etc/rc.conf:

# For jails
# Do not start automatically
jail_enable="NO"
# General jail options
jail_list="server"
jail_interface="rl0"
jail_devfs_ruleset="devfsrules_jail"
jail_devfs_enable="YES"
# Specific options for the jail 'server'.
jail_server_rootdir="/home/jails/192.168.0.100"
jail_server_hostname="server.erewhon.net"
jail_server_ip="192.168.0.100"

See /etc/defaults/rc.conf for an overview of all the settings that can be used.


For comments, please send me an e-mail.


Related articles


←  Breaking and repairing Xorg Creating a virtual server on FreeBSD with a jail  →