[Lxc-users] Seeking advice on appropriate network layout for my LXC setup

Fajar A. Nugraha list at fajar.net
Sat Jan 5 02:19:56 UTC 2013


On Sat, Jan 5, 2013 at 2:52 AM, James Gallagher <james at jamesgallagher.ie> wrote:
> I've previously used VirtualBox for a LAMP & RoR environment for
> self-hosting. I'm now running a fresh Ubuntu 12.10 VM with LXC installed. So
> far, this VM has a single interface (eth0) using VirtualBox's Bridged
> Networking and configured with a public IP. This all works fine and I tested
> connecting to a container running a web server from an external connection.

The easiest way to migrate is to simply use the same networking
configuration as before: bridged networking. The difference is with
lxc you have to create the brodge yourself. For example, if eth0 (and
thus, the bridge) use dhcp:
http://wiki.1tux.org/wiki/Ubuntu/Bridge#Bridging_a_real_network_interface

>
> I've come back around to looking at simply attaching all containers to
> lxcbr0. I don't think anything I want to run would have an issue with NAT. I
> would then port forward connections to the public IP for web onto the nginx
> container and so on for other services. The nginx container would proxy to
> the various apache container instances - as they're all connected to lxcbr0
> i'm assuming from what I've read that's as straightforward as a regular LAN.
>
> As I say, after a few days of experimenting, I'm second guessing myself on
> everything so would appreciate someone sanity checking my plan. I'm
> completely open to alternatives if there's a better way of doing this.

Basically use whatever works for you.

I like bridging the real intnerface more, but NAT should work as well.
Instead of using lxcbr0 though (which comes with dnsmasq by default),
I'd create my own bridge:
http://wiki.1tux.org/wiki/Ubuntu/Bridge#Bridge_with_IP_address

-- 
Fajar




More information about the lxc-users mailing list