[lxc-users] lx-start taking a long time if veth is not added to lxcbr0Š

Anjali Kulkarni anjali at juniper.net
Wed Oct 1 21:55:25 UTC 2014


Thank you! 
Yes, you are right, eth0 says dhcp inside container - but where did that
come from? I have statically added the IP in the container config file..
Is there any way I can add the stuff you mentioned in
/etc/network/interfaces before starting the container, for e.g., in the
container config file? All this process has to automated, and container
files cannot be edited after it is up...

Anjali

On 10/1/14 2:45 PM, "Stéphane Graber" <stgraber at ubuntu.com> wrote:

>Oh, I should have read your config a bit more closely :)
>
>Anyway, your problem is probably that /etc/network/interfaces in the
>container still says that eth0 is to be configured by dhcp.
>
>You should either put your IP configuration in the container config or
>in the container itself using the distro config mechanism, mix and match
>tends to break.
>
>My recommendation there would be to drop the IP configuration from your
>container's config and instead use the distro mechanism for it. That's
>usually the preferred choice as you'll then get the expect events inside
>the container and any distro config tool will work as expected too.
>Configuring IP addresses in the container config should be reserved to
>cases where the container rootfs doesn't have any network config
>mechanism.
>
>
>So anyway, my recommendation is to drop:
> - lxc.network.ipv4
>
>And edit /etc/network/interfaces inside the container to read something
>like:
>auto eth0
>iface eth0 inet static
>    address 172.16.0.2
>    netmask 255.255.255.0
>    gateway 172.16.0.1
>
>    dns-nameservers 172.16.0.1
>    dns-search mydomain.com
>
>Or whatever the right config is for your network.
>
>On Wed, Oct 01, 2014 at 09:37:31PM +0000, Anjali Kulkarni wrote:
>> Veth interface does get added to the br-int. It gets the IP 172.16.0.2
>> that it was given in the config file. On the container ifconfig eth0
>>shows:
>> 
>> ubuntu at vpfe:~$ ifconfig eth0
>> eth0      Link encap:Ethernet  HWaddr 00:16:3e:4c:45:ae
>>           inet addr:172.16.0.2  Bcast:172.255.255.255  Mask:255.0.0.0
>> 
>> 
>> 
>> I can ping from host to the container eth0 172.16.0.2.
>> However, I am using a combination of libvirt for the br-int bridge and
>> adding the entry manually in the /var/lib/lxc/$lxc_name/config file (not
>> using libvirt to start the lxc)- is this causing some conflicts/issues?
>> 
>> Anjali
>> 
>> On 10/1/14 2:21 PM, "Serge Hallyn" <serge.hallyn at ubuntu.com> wrote:
>> 
>> >If it takes  along time to boot then it likely isn't
>> >getting an ip address from dnmasq.  Now last I checked
>> >br-int does have a dnsmasq running, but double-check that.
>> >You can lxc-attach to the container and manually do
>> >sudo dhclient eth0
>> >
>> >This is assuming that you are on a new enough lxc so that
>> >the other veth endpoint is in fact being attached to br-int.
>> >Which version are you using?
>> >
>> >Quoting Anjali Kulkarni (anjali at juniper.net):
>> >> Hi,
>> >> 
>> >> I notice that If I add my beth link to any other bridge except
>>lxcbr0,
>> >>my ubuntu container takes a really long time to boot up, and seems to
>> >>hang/wait for a long time after this statement:
>> >>  * Starting Bridge socket events into upstart   ...done.
>> >> 
>> >> My config file is:
>> >> 
>> >> ŠŠ.
>> >> # Network configuration
>> >> lxc.network.type = veth
>> >> lxc.network.link = br-int
>> >> lxc.network.ipv4 = 172.16.0.2
>> >> lxc.network.name = eth0
>> >> lxc.network.flags = up
>> >> lxc.network.hwaddr = 00:16:3e:d9:c0:ce
>> >> 
>> >> I found out, that if I keep
>> >> lxc.network.link = lxcbr0
>> >> Instead of
>> >> lxc.network.link = br-int
>> >> 
>> >> It boots up really fast.
>> >> Is there any way to get around this? I don't want to add the veth
>> >>interface to lxcbr0, but to br-int..
>> >> 
>> >> Anjali
>> >> 
>> >
>> >> _______________________________________________
>> >> lxc-users mailing list
>> >> lxc-users at lists.linuxcontainers.org
>> >> http://lists.linuxcontainers.org/listinfo/lxc-users
>> >
>> >_______________________________________________
>> >lxc-users mailing list
>> >lxc-users at lists.linuxcontainers.org
>> >http://lists.linuxcontainers.org/listinfo/lxc-users
>> 
>> _______________________________________________
>> lxc-users mailing list
>> lxc-users at lists.linuxcontainers.org
>> http://lists.linuxcontainers.org/listinfo/lxc-users
>
>-- 
>Stéphane Graber
>Ubuntu developer
>http://www.ubuntu.com



More information about the lxc-users mailing list