vimage and jail networking
Julian Elischer
julian at freebsd.org
Tue Dec 1 09:02:34 UTC 2015
On 1/12/2015 3:49 PM, Ben Woods wrote:
> On 1 December 2015 at 06:48, Nathan Aherne <nathan at vuid.com
> <mailto:nathan at vuid.com>> wrote
interestingly this is the first time I see this email. I think
something blocked he original for me.
>
> Thank you for helping me to understand vimage better Julian! I
> have read all three links you posted a number of times.
>
I think the example in /usr/share/examples/netgraph actually does all
that you want for you.. just edit and run.
>
>
> I use iocage for jail management and it uses epair. From your
> comments it seems you recommend netgraph?
>
no
I recommend you use whatever works for you.. :-)
epair allows you to connect jails together with point to point links.
it is then jsut a routing problem.
If you want a bridged solution I think you can combine epair with
if_bridge, but haven't tried that myself.
you can achieve the exact same with netgraph. netgraph will give you
more flexibility but is more 'complex' to drive.
On the other hand its designed to be embedded in scripts. So you don't
usually have to confront the complexity each time you use it.
>
> This is the link to the iocage image instructions -
> https://iocage.readthedocs.org/en/latest/networking.html#configuring-a-vnet-jail
> <https://iocage.readthedocs.org/en/latest/networking.html#configuring-a-vnet-jail>.
> It seems that iocage does a number of things automatically or at
> least I am still confused on how to use iocage and vimage to
> have multiple jails share a single public (external) IP. I will
> continue to read the links you sent me in the hopes that the
> ahah moment comes to me.
>
> Regards,
>
> Nathan
>
>
> The public IP will be configured on whichever device you have
> connected to the internet. Normally that is a physically separate
> edge firewall/router. It has the public IP and performs NAT for any
> devices on the LAN that talk to the internet. This configuration has
> nothing to do with your jails - it is required for any computers on
> your LAN which talk to the internet.
>
> The jails are then each configured with a LAN address (10.0.0.0/8
> <http://10.0.0.0/8> range if you like). When they need to talk to
> the internet, they will go via their default route, which is
> normally your edge firewall/router, and is often given a 10.0.0.1
> address (but could be anything you like). The router will perform
> the NAT, and if you want the jails to host service listening for
> internet traffic, you will also need to configure port forwarding on
> the router to send traffic on the relevant ports to your jails on
> their LAN IP address.
>
> Note that if your router happens to be the host running the jails,
> this doesn't change any of the above.
yes usually I would have Nat on the outgoing interface of whichever
jail isn my 'final router',
and all the jails connected together by some bridge construction
that has one leg on
a second interface in the router jail (maybe the base jail but not
necessarily).
>
> Regards,
> Ben
More information about the freebsd-net
mailing list