Currently I am using vnet jails with this config:
Is there any way to know epair's interface name (or index) and using it in jail.conf when interface created? My final goal is to avoid static ${id} entries in jail.conf. One part of this question may be solved by passing interface name while creation "ifconfig epair create name epair-${name}", this creates two interfaces - epair-sample-jail01 and epairXb. But how pass to a jail epairXb?
Code:
vnet="new";
vnet.interface = "vnet0";
.....
exec.prestart = "ifconfig epair${id} create";
exec.prestart += "ifconfig epair${id}a up";
exec.prestart += "ifconfig epair${id}b name vnet0";
exec.prestart += "ifconfig bridge0 addm epair${id}a";
...
exec.poststop = "ifconfig bridge0 deletem epair${id}a;";
exec.poststop += "ifconfig epair${id}a destroy;";
.....
sample-jail01 {id=1;};
sample-jail02 {id=2;};