[lxc-users] Setting gateway via python-lxc

BB eeg5auquaephoo5j at gmail.com
Sun Dec 21 11:57:12 UTC 2014


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/c3c89c15/attachment.html>


More information about the lxc-users mailing list