[lxc-users] Setting up LXC on Ubuntu 14.04
Fajar A. Nugraha
list at fajar.net
Mon Aug 11 10:33:06 UTC 2014
On Mon, Aug 11, 2014 at 5:12 PM, Kevin LaTona <lists at studiosola.com> wrote:
>
> I've narrowed down the problem and it's more about how to setup the LXC network than LXC's themselves.
>
> What is not fully clear to me is how best to define the /etc/network/interfaces file for the way I want to run the host machine.
>
>
> lxcbr0 creates a 10.x.x.x for it's internal network usage needs while using the ubuntu template.
>
> I prefer to run a 192.168.x.x for my networking purposes.
See /etc/default/lxc-net
>
> Utlimately for now at least, I want to have a single public address that I would use iptables to route the incoming requests to the correct LXC.
>
> As this to me seems to be the simplest way to do it.
See https://help.ubuntu.com/lts/serverguide/lxc.html , "Networking"
section. There's a DNAT NAT example there.
>
>
> Where I am getting stuck right now is.
>
> What address to give the host machine on eth0 so I can still SSH into the host machine while any of the LXC's are also running.
Doesn't matter. That is, not if you only forward PORTS.
You could (for example) redirect/DNAT port 80 and 443 on the host to
the container, port 1022 on the host to container's port 22, and DON'T
redirecit port 22.
> Not sure if it's simpler to just have two NIC cards in this case.
>
> Or create a virtual NIC.
>
> Or to create a new bridge and call it br0 and then tie br0 and lxcbr0 together.
>
>
If you use a new bridge you don't need lxcbr0.
>
> If I create a config some thing like this on the Host.
>
>
> auto lo
> iface lo inet loopback
>
> auto eth0
> iface eth0 inet manual
>
>
> iface lxcbr0 inet static
don't do that
> address 192.168.0.50
> netmask 255.255.255.0
> broadcast 192.168.0.255
> network 192.168.0.0
> gateway 192.168.0.1
> dns-nameservers 8.8.8.8 8.8.4.4
> bridge_ports eth0
> bridge_fd 9
> bridge_hello 2
> bridge_maxage 12
> bridge_stp off
>
>
> As soon as I bring it up I no longer am able to SSH in the host machine.
Duh. You have no IP configured on eth0.
>
> Any thoughts about how you would or are setting up the /etc/network/interfaces doc?
>
Read the documentation.
Follow it.
Don't invent new config/setups if you don't know what it does.
--
Fajar
More information about the lxc-users
mailing list