[lxc-users] Configuration for a bridged LXC container as a proxy web server

Fajar A. Nugraha list at fajar.net
Wed Oct 28 02:32:40 UTC 2015


On Wed, Oct 28, 2015 at 12:00 AM, Itamar Gal <itamarggal at gmail.com> wrote:

> I have two LXC containers: lxc-proxy and lxc-app. I want to put lxc-proxy
> on br0 with a (static) public IP address and on lxcbr0 (with a private IP),
> and I want to put lxc-server on lxcbr0. Then I want to run Apache on
> lxc-proxy as a proxy server to relay requests to a web application on
> lxc-app.
>
>
If you need a private network with static IP assigned, create your own
bridge. Don't use lxcbr0.
Using lxcbr0 might work, but that's not what it's intended for, and may
lead to some unexpected problems. For example, one of your "normal"
containers can get a DHCP IP which you also use statically in your
"server", leading to IP conflict.



> iface eth0 inet static
>     gateway 1.2.3.1
>


> iface eth1 inet static
>     gateway 10.0.3.1
>


This isn't lxc issue. You should spend some time learning networking
basics. On most normal configurations, no matter which OS you use, there
can only be one active gateway.

Unless you REALLY know what you're dong, remove the gateway line from your
private network interface.


> lxc.network.ipv4=1.2.3.4/27 1.2.3.31
> <http://lxc.network.name>
>

For clarity and simplicity, use only ONE of lxc-configuration (the "config"
file), or container-OS-side configuration (e.g /etc/network/interfaces) to
specify IP address. Don't use both. In your case you'd probably better of
with the container-OS-side.

-- 
Fajar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20151028/31acf778/attachment.html>


More information about the lxc-users mailing list