Ir al contenido
  • +31 653-919-302
Cafayate.Net
  • 0
  • 0
  • Inicia sesión
  • Nederlands English (US) Español (AR)
  • Contáctanos
  • Inicio
  • Blog
  • Empleos
  • Contáctanos
Cafayate.Net
  • 0
  • 0
    • Inicio
    • Blog
    • Empleos
    • Contáctanos
  • +31 653-919-302
  • Nederlands English (US) Español (AR)
  • Inicia sesión
  • Contáctanos

LXC container gets two IP addresses assigned to it

  • Todos los blogs
  • Tech Blog
  • LXC container gets two IP addresses assigned to it
  • 5 de marzo de 2021 por
    Administrator

    So after a little bit more research I’ve determined why this is happening. I’m using the default Ubuntu and Debian templates to create the containers and their networking is set up so as to use DHCP to ask for a IP from the the router. So initially the static IP is set using the lxc.container.config and then when the container starts it queries the router (or whatever DHCP server you have) for a secondary IP that’s then assigned to it.

    The most logical way to stop this is likely to just assign the static ip inside the container. So on Debian based templates edit /etc/network/interfaces:

    auto etho0
    iface etho0 inet static
        address 192.168.0.15
        netmask 255.255.255.0
        gateway 192.168.0.1
    

    And then remove the ipv4 line from the lxc config /var/lib/lxc/testcontainer/config:

    lxc.network.type = veth
    lxc.network.link = br0
    

    Another method is to let the host set the ip by keeping the ipv4 line in /var/lib/lxc/testcontainer/config and to tell the container explicitly to not touch the interface by setting it to manual:

    auto eth0
    iface eth0 inet manual
    

    Apparently there are some issues with this second method if the host is suspended and then resumed. Probably best to use the first method.

    en Tech Blog
    How to attach LXC container to OVS (OpenvSwitch)

    Diseñado para empresas

    Somos un equipo de personas apasionadas cuyo objetivo es mejorar la vida de todos a través de productos revolucionarios. Creamos grandes productos para resolver sus problemas empresariales. Nuestros productos están diseñados para pequeñas y medianas empresas dispuestas a optimizar su rendimiento.

    Contáctenos

    Plantexel
    Pedernera
    Salta Capital 
    Argenina

    • +31 653-919-302
    • [email protected]
    Síganos
    Copyright © Plantexel
    Nederlands | English (US) | Español (AR)