jails please,a good tutorial

Hi to all! , I been using ezjail for yeas
but now I want to use only native tools
and VNET too
what tutorial recomend to my?
the hanbook use the bsdinstall , but
I dont use it
 
Hi to all! , I been using ezjail for yeas
but now I want to use only native tools
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.

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).
 
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.

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).
I don't see that the manual page have 3 options 🤦‍♂️
the chapter "15.3.1.2. To install a Jail from an ISO" and the example for /etc/jails.conf is right there
I probe it
 
Haven't used the others, but: The handbook shows three examples, and only one the first one uses bsdinstall ;)
firts of all I pass the 3 methods of create and install a jail , the chapter 15.3.1.2 dont use bsdinstall, you right
 
I want to throw out a suggestion since you mentioned VNET.
I use multi port ethernet adapters and I really like passing the whole ethernet port straight through to a jail
It's the same approach I use with bhyve. It really takes the bridge and tap out of the picture.
I use an upstream firewall & DHCP server. So it really is a simple setup. No speed reductions as found with bridge/tap.
Install Dual/Quad port NIC and pass them thru.... I do have a 48 port copper switch so its no big deal.
10G cards offer some virtual features that work with jails.

You really need to dive in and just use the tutorials as guidance. Pick the desired route that best meets your task.
There are many ways to plumb a jail.
 
Looking at the article it seems fine. They do use 10.2-RELEASE version so that would have to be taken into account.
So if you are following along line by line you may be in trouble.

What the real difference is these articles use two different methods for setting up the base jail.
The hard way way you have to download the base files and extract them versus using bsdinstall jail. A much simpler method.
 
Not the most recent but still good info regarding using netgraph with jails..
So many different ways to plumb it.
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.

It really is the Ultimate desktop OS. For me. Maybe you, too.
 
thanks to all for your responses, I take a bit of code of every tutorial here and outside..I create a functional jail in few easy steps
the /etc/jail.conf need to be more customized and need to add VNET support, but for start:
is more likely the tird option of ShelLuser

Code:
#1: first create the zfs volume
#my dir for jails is /media/jail

zfs create -o mountpoint=/media/jail zroot/data

Code:
#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 ./

Code:
#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

Code:
#6: add to /etc/hosts the ip that the jail lo1 will use

127.0.1.11              test

#here I named my jail "test"

Code:
#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

Code:
#8 : add to rc.conf

jail_enable="YES"

#and run:

service jail start

Code:
#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
 
Back
Top