I've never used
sysutils/ezjail, I do use
sysutils/iocell and I just do need to set dhcp=on.
iocell(8)
+1 for
sysutils/iocell although silence on the mailing list is not giving much confidence about the future.
sysutils/ezjail is abandoned because the author got pissed off (rightfully so) that
sysutils/qjail author has stolen his code and FreeBSD people are not removing that crap (crap refers to
sysutils/qjail) from the ports. That is regrettable because there are situations in which UFS is preferable over ZFS (like in the case of embedded deployments) and iocell supports only Jail on the top of ZFS.
So, yes you can use DHCP in jail
BUT you need
vnet(9) and
bpf(4).
VNET is not production ready. It can crash the host when you "power off" jail instance, IIRC also requires IPFW and it doesn't work with PF. There is a reason it is not enabled in generic kernel. Frankly I would not touch anything which requires kernel recompilation with a three-foot-long broomstick.
cabriofahrer
Your confusion is understandable. FreeBSD handbook is poorly maintained and deliberately misleading. FreeBSD also doesn't take a pride in their man pages. The fact that every single example of jail networking you can find by Googling seems describe the situation in which Jail uses just another IP (an alias) assigned to a physical network interface on the host should rise a red flag. Jail network infrastructure is neither complete nor production ready. Jail can only use another static IP which is assigned to the same physical interface as the host. It also have to use the same routing tables and more or less can use only the same firewall rules as the host system. You should also bare in mind that Jails safer the same security flaws which killed OpenBSD's
sysjail as discovered by Kristaps Dzonsons.
That more or less reduces the usefulness of the jail infrastructure to the very simple cases (which I do use in production at work). That is very sad because in spite of its security flaws Jail infrastructure is far more appealing as a light weight sand-boxing of various services than for example Linux Containers or full blown virtualization like OpenBSD's vmm.
If you are truly interested in FreeBSD and good coder a great way to jump into the project will be to start by reading Joel Knight's (Cisco Engineer) OpenBSD blog and how virtualization of routing tables is done on OpenBSD
https://www.packetmischief.ca/2011/09/20/virtualizing-the-openbsd-routing-table/
Than think weather something like that could be technically possible with FreeBSD jails.
Another thing that really pisses me off is system admin tools like iocell have to be installed from the ports. That should be the part of the base. FreeBSD should have enough in its base to be able to automatically deploy, manage, snapshot, remote replicate, and even hot migrate few dozens of Jails right out of box.