Solved Jails with IP from DHCP?

forquare

Well-Known Member

Reaction score: 186
Messages: 335

Afternoon all,

On my home network I have three VirtualBox VMs that I would like to condense into a single VM, this single VM would have three jails each running a service.
Currently each VM has a VirtualBox bridged adaptor, on my router I see each VM having its own MAC address, and the router is responsible for assigning IPs and ensuring that a given MAC address always gets the same IP.

I am unsure how to mimic this with jails. I think I did something similar back in 2009/2010 with OpenSolaris Zones and project Crossbow, by attaching vNICs to Zones and then connecting them to a vSwitch which bridged onto my home network. The Zones got their IPs via DHCP from the router. It was a while ago and I’ve not touched Solaris in some time.

Remembering Crossbow, I sought for something similar in FreeBSD and fount NETGRAPH and ngctl(8). I’ve had a read through the man page and done some searching, but I am none the wiser about how to achieve what I desire—part of this is undoubtedly my “fear” of the black magic that is networking…

Does anyone know of a way to achieve this? Or am I wanting something that is not possible?
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,680
Messages: 39,278

I think this is going to be tricky. Jails are using the host's interfaces, the addresses are simply added as aliases. As it's the same interface there's no way to set the MAC address differently for each jail. It may work if each jail is connected to a cloned interface (lo1, lo2, etc) and these are then bridged to the host's interface. It's a bit of a shot in the dark as I've never tried this.
 

tobik@

Daemon
Developer

Reaction score: 1,421
Messages: 1,909

Currently each VM has a VirtualBox bridged adaptor, on my router I see each VM having its own MAC address, and the router is responsible for assigning IPs and ensuring that a given MAC address always gets the same IP.
Assign three network adapters to the VM, one for each jail. Each as a bridged adapter.
 
Top