[lxc-users] Setting gateway via python-lxc

BB eeg5auquaephoo5j at gmail.com
Sun Dec 21 13:29:59 UTC 2014


Hallo again,

I just noticed that even though I set:
     >>> container.network[0].ipv4 = '10.0.10.3/24'

     >>> container.network[0].ipv4
     ['10.0.10.3']
     >>> container.save_config()

The container's config contains:
     lxc.network.ipv4 = 10.0.10.3/8

I also tried:
    >>> container.set_config_item('lxc.network.0.ipv4', '10.0.10.3/24')
    False

Kind regards,

BB

On Sun, Dec 21, 2014 at 12:57 PM, BB <eeg5auquaephoo5j at gmail.com> wrote:

> Hi,
>
> I am trying to set a custom bridge interface for a container:
>     >>> container.network[0].link = 'my_bridge'
> This works fine as does setting ipv4 and veth_pair but I cannot find any
> way to set the gateway:
>     >>> container.network[0].ipv4_gateway
>     ''
>     >>> container.network[0].ipv4_gateway = '10.0.10.1'
>
>     >>> container.network[0].ipv4_gateway
>     ''
>     >>> container.get_config_item('lxc.network.0.ipv4_gateway')
>     ''
>     >>> container.set_config_item('lxc.network.0.ipv4_gateway',
> '10.10.0.1')
>     False
>     >>> container.set_config_item('lxc.network.0.ipv4_gateway', 'auto')
>     lxc_container: Resource temporarily unavailable - invalid ipv4
> address: auto
>
> I also noticed that when I set
>     >>> container.network[0].ipv4_gateway = '10.0.10.1'
> ipv4 contains:
>     >>> container.network[0].ipv4
>     ['10.0.10.3', '10.0.10.1']
> Before setting ipv4_gateway, ipv4 contains only the first IP address that
> I configured in a previous step.
>
> Am I using the API wrong?
>
> Best regards,
>
> BB
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20141221/9e1e6b84/attachment.html>


More information about the lxc-users mailing list