Ivan Tomica

FreeBSD Jails – dynamically assign IP address using ezjail

Instead of adding all IP addresses statically to your server via host’s /etc/rc.conf file you may instead leave them out and specify them on per-jail basis. That way when Jail is started IP address gets assigned to specific network interface, and when it is shut down it disappears from that interface.

This comes in really handy especially when you’re managing lots of IPv6 only jails, adding all IP addresses to the interface could be tedious and your rc.conf would be more so.

Options you need in your ezjail jail configuration file are:

export jail_JAILNAME_interface="em0"
export jail_JAILNAME_ip="em0|IP"

Now, every time jail starts IP will automatically get assigned to the em0 interface, and when it shuts down it will get removed.

Tagged in:,
Sysadmin on the everlasting journey of learning. Always in search for an opportunity to prove myself and to learn something new. My addiction is learning and my main goal is to excel in every aspect of Linux/Unix system administration.


Leave a Reply

Your email address will not be published. Required fields are marked *