[lxc-users] Specifying different routes/metrics on lxc.network.ipv4.gateway

Gunnar Wolf gwolf at gwolf.org
Thu Jul 30 17:34:03 UTC 2015


Hi,

I have a lxc acting as a router/firewall, and recently added a backup
channel — But I'm having problems expressing it to lxc. I am
temporarily solving it by manually calling "service networking
restart" from inside my container, with the following snippet in
/etc/network/interfaces:

    auto ext
    iface ext inet static
            address 10.0.252.161
            netmask 255.255.255.252
            gateway 10.0.252.162
            metric 0

    iface ext inet static
            address 10.0.124.113
            netmask 255.255.255.252
            gateway 10.0.124.114
            metric 5

However, I would prefer to express this via the lxc config file. So,
the relevant snippet for my /var/lib/lxc/gw/config reads:

    lxc.network.type = veth
    lxc.network.flags = up
    lxc.network.link = br1
    lxc.network.name = ext
    lxc.network.hwaddr = 00:11:ec:10:12:01
    lxc.network.ipv4 = 10.0.252.161/30
    lxc.network.ipv4 = 10.0.124.113/30
    lxc.network.ipv4.gateway = 10.0.252.162
    # lxc.network.ipv4.gateway = 10.0.124.114 metric 5

Of course, the last line is commented, as I don't know how to express
it. Is there a way to add a second lxc.network.ipv4.gateway
declaration? If so, can a metric be specified to it?

Thanks a lot!


More information about the lxc-users mailing list