Creating a jail with EZJail PrefaceAlthough you can maintain your FreeBSD jails manually and there are quite a few tutorials around, I like the implementation done through EZJails.
It’s assumed you have completed installing FreeBSD and EZJail.
Creating/Starting a JailTo create the jail we need to create an alias for the network interface, issue the ezjail-admin create command w/flavor, and finally start the jail:
ifconfig lnc0 192.168.1.50 netmask 255.255.255.255 alias ezjail-admin create -f standard www.kingsquarry.net 192.168.1.50 /usr/local/etc/rc.d/ezjail.sh start www.kingsquarry.netOnce the jail is started it’s critical that we login and perform a couple clean-up tasks (setting root’s password, time zone, and finishing the sendmail configuration):
ssh 192.168.1.50 -l admin passwd <- Change your password su - passwd <- Give a password for the root account tzsetup cd /etc/mail make install-submit-cf /etc/rc.d/sendmail restart exit exitSince we’ve disabled the sendmail solution we’ll need to redirect all command-line generated mail to our real server, besides jails cannot talk on the localhost address (127.0.0.1). First, we need to create the submit file:
cd /etc/mail make install-submit-cfEdit the mc file (fqdn.submit.mc) created by running the above command and change the existing “FEATURE(`msp’…):
msp', [your.mail.server.here.net]’)dnlSave the above changes and once again execute the following:
make install-submit-cfFinally, make sure your eMail server is configured properly to receive eMail from and, possibly, to recieve eMail directed to this host.
Logout of the jail, returning to the host BSD session and, if needed, add the alias to the /etc/rc.conf file:
ifconfig_lnc0_alias0=“192.168.1.50 netmask 0xffffffff”
ConclusionYou should now have a base Jail with associated flavor for creating some initial items. If you have a constant DNS setup then adding resolv.conf to the standard flavour would be a nice time saver.