iocage helper thread

Junicast

Patron
Joined
Mar 6, 2015
Messages
206
Hi,

since I love jails and already love the new iocage I just wanted to share some hints since the UI doesn't really help me.
I expect a new jail to be there with a name and a release set, nothing else.

set jail hostname
iocage set host_hostname="yourhostname" <<jailname>>

enable DHCP
iocage set vnet=on bpf=yes dhcp=on <<jailname>>

attach console
iocage console <<jailname>>

update jail to latest patch
iocage update <<jailname>>
This is one of THE major improvements since I've been dragging warden jails since FreeNAS 9 or something.

stop jail
iocage stop <<jailname>>

start jail
iocage start <<jailname>>

mount zfs volume
iocage fstab -a <<jailname>> <<path>>
Example
iocage fstab -a myjail "/tank/myfs /mnt/myfs nullfs rw 0 0"

list zfs mounts
iocage fstab -l <<jailname>>

unmount zfs volume
iocage fstab -r <<jailname>> <<path>>
instead of giving the full fstab path you can also use the index given when using the fstab -l command.

set IPv4 manually
iocage set ip4_addr="vnet0|192.168.0.10/24" <<jailname>>

set IPv6 manually (not working)
iocage set ip6_addr="vtnet0|2001:123:456:242::5/64" <<jailname>>
iocage set defaultrouter6="2001:123:456:242::1" <<jailname>>

To me it looks like IPv6 doesn't work at all, even if I assign a static IPv6 address manually within the jail with
ifconfig vnet0 inet6 2001:123:456::1 prefixlen 64
I cannot even ping another host in my LAN.
IPv6 autoconf also not working: https://redmine.ixsystems.com/issues/24607

That's it for now. If people like it I will extend this little howto :)[/CMD]

Edit:
After struggling quite some time with IPv6 and 11.2U6 I found out that:
1. IPv6 autoconfig does not work at all
2. IPv6 DHCPv6 does not work at all
3. IPv6 static configuration works but only if you configure IPv4 statically, too :eek:
Hopefully 11.3 will deliver some new options when it comes to networking.
 
Last edited:

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977
update jail to latest patch
iocage update <<jailname>>
This is one of THE major improvements since I've been dragging warden jails since FreeNAS 9 or something.
Be careful with this one. FreeNAS lags a bit behind the current patched release of FreeBSD and you can end up with a jail on a newer patch level than the base OS. With FreeBSD it's not a concern as you can freely patch the OS unlike FreeNAS. I would reserve this one to testing until it can be fleshed out a bit more and make sure things don't end up broken.
 
  • Like
Reactions: jg3

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977
Also you may want to add some of the networking fixes listed in this post and also in this post to help new iocage users that run into networking issues with new iocage jails.
 

jg3

Dabbler
Joined
May 17, 2017
Messages
20
Is there a way to create a file using `iocage exec` to cat << EOF with a heredoc?


Code:
root@fn:~ # iocage exec jackett cat << EOF > /usr/local/etc/rc.d/testfile
? # this is line one of the testfile
? Hello World!
? Hello \$SHELL
? Hello from $PWD
? EOF


And, although nothing showed up inside my jail, I did create the file in the FreeNAS filesystem:

Code:
root@fn:~ # cat /usr/local/etc/rc.d//testfile

Hello World!
Hello $SHELL
Hello from /root


Although, you'll notice that the first line with the hash is missing. I suppose I'll have to escape it to create a shell script.

Is there a way to do this that I'm missing? I've searched a bit for iocage help in other places but it doesn't seem to have much uptake outside of FreeNAS from what I can tell.
 

ikke

Contributor
Joined
Apr 22, 2012
Messages
124
@jg3 you probably already figured this out, but I only now run into this question as I was looking info for iocage net setup. Anyhow:

You know you can do it from the host directly to jail filesystem, no need for iocage with that. Just find the path where your jails do reside, like e.g.: /<path to your jails zfs root>/<jailname>/usr/local/etc/rc.d/testfile
 
Top