[lxc-users] Setting up LXC on Ubuntu 14.04

Kevin LaTona lists at studiosola.com
Tue Aug 12 01:19:04 UTC 2014


On Aug 11, 2014, at 3:33 AM, Fajar A. Nugraha <list at fajar.net> wrote:

> On Mon, Aug 11, 2014 at 5:12 PM, Kevin LaTona <lists at studiosola.com> wrote:
> 
> 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


I found this setup along my google travels.



> 
>>   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.


Can any one fill in why not do it this way.

And or how you might do it otherwise?

I thought on a bridge set up like this that you assign the ip to the bridge iface?



I've since added post up and pre-down rules and things are starting to come together now

-------------------- host /etc/network/interfaces-----------------
auto lo
iface lo inet loopback


auto eth0
iface eth0 inet manual


auto lxcbr0
iface lxcbr0 inet static
    address 192.168.0.50
    netmask 255.255.255.0
    gateway 192.168.0.1
    network 192.168.0.0
    broadcast 192.168.0.255

    dns-nameservers 8.8.8.8
   bridge_ports eth0
   bridge_stp off
   bridge_fd 0

   post-up echo 1 > /proc/sys/net/ipv4/ip_forward
   post-up iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

   pre-down echo 0 > /proc/sys/net/ipv4/ip_forward
   pre-down iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE





Then inside a container I assign a static ip address and for now it starting to work as I thought it might.

 ------------container --- var/lib/lxc/k2/rootfs/etc/network/interfaces ------------

auto eth0
iface eth0 inet static
        address 192.168.0.102
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.168.0.255
        gateway 192.168.0.1
        dns-nameservers 8.8.8.8 8.8.4.4





-Kevin
























More information about the lxc-users mailing list