Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Dec 2016 19:36:28 +0100
From:      Michael Grimm <trashcan@ellael.org>
To:        freebsd-questions@freebsd.org
Cc:        freebsd-jail@FreeBSD.org
Subject:   Re: multiple interfaces for jail.conf(1) and jail_set(2)
Message-ID:  <E01E3F3B-C24B-4BF2-B0B4-1E1DF9CB296F@ellael.org>
In-Reply-To: <56419.128.135.52.6.1481751332.squirrel@cosmo.uchicago.edu>
References:  <0ED7F403-F14E-4A72-8E54-AF74AAE15061@blackskyresearch.net> <45822529-2096-4B32-8515-F5875BEF7101@ellael.org> <56419.128.135.52.6.1481751332.squirrel@cosmo.uchicago.edu>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
[cc'd to freebsd-jail@FreeBSD.org where that thread originated]

Valeri Galtsev <galtsev@kicp.uchicago.edu> wrote:

> On Wed, December 14, 2016 2:30 pm, Michael Grimm wrote:

>> #
>> # network settings to apply/destroy during start/stop of every jail
>> #
>> exec.prestart		 =3D "sleep 2";
>> exec.prestart		+=3D "/sbin/ifconfig epair${jailID} =
create up";
>> exec.prestart		+=3D "/sbin/ifconfig bridge0 addm =
epair${jailID}a";
>> exec.start		 =3D "/sbin/sysctl net.inet6.ip6.dad_count=3D0";
>> exec.start		+=3D "/sbin/ifconfig lo0 127.0.0.1 up";
>> exec.start		+=3D "/sbin/ifconfig epair${jailID}b inet =
${ip4_addr}";
>> exec.start		+=3D "/sbin/ifconfig epair${jailID}b inet6 =
${ip6_addr}";
>> exec.start		+=3D "/sbin/route add default -gateway =
10.1.1.254";
>> exec.start		+=3D "/sbin/route add -inet6 default -gateway =
${ip6prefixLOCAL}::254";
>> exec.stop		 =3D "/sbin/route del default";
>> exec.stop		+=3D "/sbin/route del -inet6 default";
>> exec.stop		+=3D "/bin/sh /etc/rc.shutdown";
>> exec.poststop 		 =3D "/sbin/ifconfig epair${jailID}a =
destroy";
>>=20
>> #
>> # individual jail settings
>> #
>> dns {
>> 	$jailID		 =3D 1;
>> 	$ip4_addr	 =3D 10.1.1.1;
>> 	$ip4_addr_2	 =3D 10.1.1.2;

[=E2=80=A6]

> Michael, is it possible to have two addresses belonging to two =
different
> networks (through two different network interfaces)?
>=20
> Say, on host system:
>=20
> ifconfig_igb0=3D"inet 172.20.9.22 ...
> ifconfig_igb1=3D"inet 10.1.1.17 ...
>=20
>=20
> and in some jail
>=20
> 	$ip4_addr	 =3D 172.20.9.22;
> 	$ip4_addr_2	 =3D 10.1.1.17;
>=20
> - will that work? This is what didn't work for me in the past when
> configured jails old style in /etc/rc.conf

I can't answer that because I have never tried it before.

Those exec.<foo> will give you a very fine-grained control over which =
commands are run at the host environment (exec.prestart, exec.poststop, =
exec.poststart) or within the jail's environment (exec.start, exec.stop, =
exec.prestop) in which order. Have a look at jail(8) for details (and =
presumably more exec.<variants>).

Therefore I am quite confident that whatever could be done with jails =
might be "coded" into jail.conf.

Regards,
Michael







Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?E01E3F3B-C24B-4BF2-B0B4-1E1DF9CB296F>