FreeBSDJail

WebHome | UnixGeekTools | Geekfarm | About This Site

External Pointers

Internal Pointers

Starting up

    /etc/rc.d/jail start
    /etc/rc.d/jail stop
    /etc/rc.d/jail start myjail
    /etc/rc.d/jail stop myjail

    ifconfig dc0 inet alias 192.168.1.99/32
    mount -t procfs proc /export/mirror01/cluster/jail/proc
    mount -t devfs dev /export/mirror01/cluster/jail/dev
    jail /export/mirror01/cluster/jail geektank 192.168.1.99 /bin/sh /etc/rc

    ifconfig dc0 inet delete 192.168.1.99

Maintenance

Copy an existing jail

    mkdir /usr/jail/new
    cd /usr/jail/old
    tar -cpf - . | tar -C /usr/jail/new -xpf -

alternate solution

# cpdup /jail/directory /newjail/directory
# jail /newjail/directory newjail.hostname newjailip /bin/sh /etc/rc

Initial Filesystem Setup

    cd /usr/src
    mkdir -p /export/mirror01/cluster/jail
    make -j4 world DESTDIR=/export/mirror01/cluster/jail
    make -j4 distribution DESTDIR=/export/mirror01/cluster/jail
    mount_devfs devfs /export/mirror01/cluster/jail/dev

Automatic Startup

service IP Addresses

Configure all services on the host and jails to the proper interface.

Configuring the jail

    jail /path/to/jail testhostname 192.168.11.100 /bin/sh

    # example:
    jail /export/mirror01/cluster/jail geektank.subaudi.net 192.168.1.99 /bin/sh

Installing ports

    # build on the main system:

    $ cd /var/db/pkg/fontconfig-2.2.0/
    $ pkg_create -v -c +COMMENT -d +DESC -f +CONTENTS -m +MTREE_DIRS ~/fontconfig-2.2.0.tgz

Nagios

If you run NagioS inside a FreeBSDJail, the default check_ping won't work since, at this time, it isn't a good idea to enable ping in a jail. I used some code I found on the web to create this tcp ping replacement for check_ping.

Note that some servers or other devices may not respond to a tcp ping.




Updated Sun Jul 23, 2006 3:56 PM