bastille icon indicating copy to clipboard operation
bastille copied to clipboard

[ENHANCEMENT] Convert to vnet

Open OnigamiSama opened this issue 4 years ago • 1 comments

Is your feature request related to a problem? Please describe. So I wanted to try vnet jails because some services might not be running in "regular" jails, like qbittorrent

Describe the solution you'd like Would be great to be able to convert a regular jail to a vnet one like we can do with thin to thick jails

Describe alternatives you've considered I'm currently exporting my jail, gonna tweak the jail.conf by hand to try to make vnet work

Additional context Nothing more to says other that all my next jails will be thick and vnet ;p

OnigamiSama avatar Apr 04 '20 16:04 OnigamiSama

For anyone looking to do the same it is fairly simple.

  1. Edit the jail.conf for the jail to be converted to VNET Add the following lines, replacing X with a free number 2, 3, 4 .. NIC with your network interface and JAILNAME with your jails name:
  vnet;
  vnet.interface = e0b_bastilleX;
  exec.prestart += "jib addm bastilleX NIC";
  exec.prestart += "ifconfig e0a_bastilleX description \"vnet host interface for Bastille jail JAILNAME\"";
  exec.poststop += "jib destroy bastilleX";

Comment or remove the following lines:

  interface = em0;
  ip4.addr = aa.bb.cc.dd;
  ip6 = disable;
  1. Edit the jail /etc/rc.conf Add the following lines (the X should match the unique number you chose in the first step)
ifconfig_e0b_bastilleX_name="vnet0"
ifconfig_vnet0="inet aa.bb.cc.dd"

Replace aa.bb.cc.dd with your preferred IP address.

dijitaltrix avatar Jun 15 '22 13:06 dijitaltrix

I'll add that you may need to set defaultrouter in the jail's rc.conf. Also, if you have not created any bastille vnet jails, then you'd need:

install -m 0544 /usr/share/examples/jails/jib /usr/local/bin/jib

avg-I avatar Oct 14 '22 09:10 avg-I

VNET fully supported today in current release. Solution above posted to change a jail from non-vnet to vnet.

Closing.

bmac2 avatar Oct 19 '23 00:10 bmac2

It still would be nice if bastille had a command (or, at the very least, documentation) on how to do the conversion. But I guess that internet search and/or likes of ChatGPT are considered good enough these days :slightly_smiling_face:

avg-I avatar Oct 19 '23 05:10 avg-I