[Lxc-users] Setting up server in lxc container for dummies

Kevin LaTona lists at studiosola.com
Thu Aug 1 04:35:26 UTC 2013


Hi Dan,


I've just started working with LXC so this how I am doing it and maybe some one else can fill in any areas I've left out.

If you are going to have a local LAN and outside WAN connection than you will need two ethernet cards ( 1 for each network )

Unless you already have a router setup that can punch a hole into your local network's firewall creating a DMZ connection for that container.


What I have been doing is creating a bridge on the host with a static ip.

Then each container is configured to it's own static ip address inside the container's /etc/network/interface config doc

If you check out this mailing list's archive for the last week or so you will find an example of most of my config files I used in this test.

The problem I was having is the gateway on a container was not loading .

So I ending up writing a simple Ubuntu startup script to manually load the gateway settings at the container's OS boot time.

For now it does the job until I can figure out why.


Bellow are the document paths to most config files you will need to deal with.

There are plenty of good blog post out on the web that will give you deeper details.



Finally you may want to check out this project to see it might make all the above easier for your needs. http://lxc-webpanel.github.io

I looked at it but ended up doing all manual configurations, as I wanted to better understand LXC structure for now.


Good luck.
-Kevin



Host ( create bridge )
/etc/network/interfaces


/etc/sysctl.conf
net.ipv4.ip_forward = 1


/etc/lxc/lxc.conf

/etc/default/lxc


/var/lib/lxc/containers_name/config

/var/lib/lxc/conatianers_name/rootfs/etc/network/interfaces





On Jul 31, 2013, at 8:24 PM, Dan Kegel <dank at kegel.com> wrote:

> Hi,
> I've been happily using ubuntu's stock lxc (originally
> in 12.04, now in 13.04), and finally have an occasion
> to run a server inside a container.  I'd like it to
> be visible from the outside.
> 
> There are plenty of web pages about this, but they seem to
> assume that you've created the lxc config file by hand.
> I have never done that; I just use whatever lxc-create creates.
> 
> What's the simplest way to get a container to look
> like just another host on the LAN, starting with
>   sudo apt-get install lxc
>   sudo lxc-create -t ubuntu -n foobar
> on ubuntu 13.04?
> 
> Thanks,
> Dan





More information about the lxc-users mailing list