Well, the first thing to understand here is what a jail actually is; and the answer to that is simple: it's basically a userland environment (in other words: a default FreeBSD installation) which gets executed by the kernel of the host. As Howard already mentioned above me: see jail(8) for a good example on how to set it up. Chapter 15 of the handbook can also be useful.Hi to all! , I been using ezjail for yeas
but now I want to use only native tools
Haven't used the others, but: The handbook shows three examples, and only one the first one uses bsdinstallthe hanbook use the bsdinstall , but
I dont use it
I don't see that the manual page have 3 optionsWell, the first thing to understand here is what a jail actually is; and the answer to that is simple: it's basically a userland environment (in other words: a default FreeBSD installation) which gets executed by the kernel of the host. As Howard already mentioned above me: see jail(8) for a good example on how to set it up. Chapter 15 of the handbook can also be useful.
However... That doesn't fully mention how to install the whole thing in my opinion. Basically you have 3 solid ways to install a jail:
* First is to use bsdinstall as mentioned by the handbook.
* The second option could be to use the source tree and build your own userland (might be a little overkill).
* And three, my preferred option, simply grab base.txz and optionally kernel.txz from a repository and extract that into directory where you intend your jail to get installed.
After you've done that all that's left to do is to actually configure your base system and set up /etc/jails.conf (as explained by the previously mentioned manualpage).
firts of all I pass the 3 methods of create and install a jail , the chapter 15.3.1.2 dont use bsdinstall, you rightHaven't used the others, but: The handbook shows three examples, and only one the first one uses bsdinstall
Were there any incorrect or out of date examples? If so I'll delete the post.jdakhayman Does it matter that article is over five years old? I don't know.
bsdinstall jail
. A much simpler method.I don't know. That's what I'm asking.Were there any incorrect or out of date examples?
I was just saying what a usr friendly desktop oriented OS FreeBSD is and how many different ways there to make it do the same thing.Not the most recent but still good info regarding using netgraph with jails..
So many different ways to plumb it.
#1: first create the zfs volume
#my dir for jails is /media/jail
zfs create -o mountpoint=/media/jail zroot/data
#2: get the FreeBSD base
cd /media/jail
wget ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/amd64/13.0-RC3/base.txz
#I use 13.0-RC3
#then descompress it in the jail folder
tar -xvf base.txz -C ./
#3: add a clone interface and run the command to ifconfig create it
#4: add to /etc/rc.conf:
cloned_interfaces="lo1"
#5: and run :
service netif cloneup
#6: add to /etc/hosts the ip that the jail lo1 will use
127.0.1.11 test
#here I named my jail "test"
#7: create /etc/jail.conf
exec.clean;
mount.devfs;
test {
host.hostname = test;
host.domainname = test;
ip4.addr = 'lo1|127.0.1.11/32';
ip4.addr += 're0|192.168.4.11/24';
}
#here is the ip for lo1 , that's what I declare like "test" in
#the host file /etc/hosts , and the ip 192.168.4.11/24 that is one
#ip in my host machine in the re0 interface (internet)
#I have a ip range 192.168.4.0/24
#8 : add to rc.conf
jail_enable="YES"
#and run:
service jail start
#9 check your jail and use it
#check the jail
jls
#returns:
#JID IP Address Hostname Path
# 1 127.0.1.11 test /media/jail
#now you can run the jail by id or name
jexec 1
or (recomended)
jexec test
#edit /etc/resolv.conf and add a dns server
vi /etc/resolv.conf
#and a dns server and close the file
#test internet
telnet {server} 80
#and thats it :) a basic jail