[lxc-users] multiple veths cannot configure for each default gateway

Nakayama Kenjiro nakayamakenjiro at gmail.com
Sat Apr 12 03:33:03 UTC 2014


Hi,

I tried to set up multiple veth and default GW for each veth in one
container[1] by using docker with following command [2].
But I got an error[3]. (When I setup with only one Default GW, it works
well. So I think I can not default GW for each veth (eth0, eth1).)

Is this my mis-configuration or lxc's bug?
Can anybody figure out the cause of this problem?

Thank you in advance.

Kenjiro

[1]
     +-----------------+ Default GW
     | +-------------+ | +-------+
     | |    veth0    | | |  br1  |
     | |172.16.42.20 |-|-|docker1|--
     | +-------------+ | +-------+
     |                 |
     |                 | Default GW
     | +-------------+ | +-------+
     | |    veth1    | | |  br2  |
     | |172.16.42.20 |-|-|docker2|--
     | +-------------+ | +-------+
     +-----------------+

[2] docker execute command.
docker run \
-n=false \
-lxc-conf="lxc.network.type = veth" \
-lxc-conf="lxc.network.name = eth0" \
-lxc-conf="lxc.network.ipv4 = 172.16.42.20/24" \
-lxc-conf="lxc.network.ipv4.gateway = 172.16.42.1" \
-lxc-conf="lxc.network.hwaddr = 00:FF:80:FF:FF:02" \
-lxc-conf="lxc.network.link = docker1" \
-lxc-conf="lxc.network.flags = up" \
-lxc-conf="lxc.network.type = veth" \
-lxc-conf="lxc.network.name = eth1" \
-lxc-conf="lxc.network.ipv4 = 172.16.42.21/24" \
-lxc-conf="lxc.network.hwaddr = 00:FF:80:FF:FF:01" \
-lxc-conf="lxc.network.ipv4.gateway = 172.16.42.2" \
-lxc-conf="lxc.network.link = docker2" \
-lxc-conf="lxc.network.flags = up" \
-i -t --name tmp1 mptcp-test /bin/bash

[3] Error when executed docer run.
~~~
Warning: '-lxc-conf' is deprecated, it will be removed soon. See usage.
Warning: '-lxc-conf' is deprecated, it will be removed soon. See usage.
Warning: '-lxc-conf' is deprecated, it will be removed soon. See usage.
Warning: '-lxc-conf' is deprecated, it will be removed soon. See usage.
Warning: '-lxc-conf' is deprecated, it will be removed soon. See usage.
Warning: '-lxc-conf' is deprecated, it will be removed soon. See usage.
Warning: '-lxc-conf' is deprecated, it will be removed soon. See usage.
Warning: '-lxc-conf' is deprecated, it will be removed soon. See usage.
Warning: '-lxc-conf' is deprecated, it will be removed soon. See usage.
Warning: '-lxc-conf' is deprecated, it will be removed soon. See usage.
Warning: '-lxc-conf' is deprecated, it will be removed soon. See usage.
Warning: '-lxc-conf' is deprecated, it will be removed soon. See usage.
Warning: '-lxc-conf' is deprecated, it will be removed soon. See usage.
Warning: '-lxc-conf' is deprecated, it will be removed soon. See usage.
lxc-start: failed to setup ipv4 gateway for 'eth1': File exists
lxc-start: failed to setup netdev
lxc-start: failed to setup the network for
'41794d153bafe7dc14dcc28520ff9f82b432ffcaed91572b6414d785d60db0dc'
lxc-start: failed to setup the container
lxc-start: invalid sequence number 1. expected 2
lxc-start: failed to spawn
'41794d153bafe7dc14dcc28520ff9f82b432ffcaed91572b6414d785d60db0dc'
lxc-start: Device or resource busy - failed to remove cgroup
'/sys/fs/cgroup/cpuset/lxc/41794d153bafe7dc14dcc28520ff9f82b432ffcaed91572b6414d785d60db0dc'
lxc-start: Device or resource busy - failed to remove cgroup
'/sys/fs/cgroup/cpu,cpuacct/lxc/41794d153bafe7dc14dcc28520ff9f82b432ffcaed91572b6414d785d60db0dc'
lxc-start: Device or resource busy - failed to remove cgroup
'/sys/fs/cgroup/memory/lxc/41794d153bafe7dc14dcc28520ff9f82b432ffcaed91572b6414d785d60db0dc'
lxc-start: Device or resource busy - failed to remove cgroup
'/sys/fs/cgroup/devices/lxc/41794d153bafe7dc14dcc28520ff9f82b432ffcaed91572b6414d785d60db0dc'
lxc-start: Device or resource busy - failed to remove cgroup
'/sys/fs/cgroup/freezer/lxc/41794d153bafe7dc14dcc28520ff9f82b432ffcaed91572b6414d785d60db0dc'
lxc-start: Device or resource busy - failed to remove cgroup
'/sys/fs/cgroup/net_cls/lxc/41794d153bafe7dc14dcc28520ff9f82b432ffcaed91572b6414d785d60db0dc'
lxc-start: Device or resource busy - failed to remove cgroup
'/sys/fs/cgroup/blkio/lxc/41794d153bafe7dc14dcc28520ff9f82b432ffcaed91572b6414d785d60db0dc'
lxc-start: Device or resource busy - failed to remove cgroup
'/sys/fs/cgroup/perf_event/lxc/41794d153bafe7dc14dcc28520ff9f82b432ffcaed91572b6414d785d60db0dc'
lxc-start: Device or resource busy - failed to remove cgroup
'/sys/fs/cgroup/hugetlb/lxc/41794d153bafe7dc14dcc28520ff9f82b432ffcaed91572b6414d785d60db0dc'
[error] client.go:2298 Error getting size: bad file descriptor
~~~

[4] Bridge setting
~~~
#!/bin/sh

# Name of the bridge
FIRST_BRIDGE_NAME=docker1

# Bridge address
FIRST_BRIDGE_ADDRESS=172.16.42.1/24

# Add the docker1 bridge
brctl addbr $FIRST_BRIDGE_NAME

# Set up the IP for the docker1 bridge
ip a add $FIRST_BRIDGE_ADDRESS dev $FIRST_BRIDGE_NAME

# Activate the bridge
ip link set $FIRST_BRIDGE_NAME up

### ----------------------- ###

# Name of the bridge
SECOND_BRIDGE_NAME=docker2

# Bridge address
SECOND_BRIDGE_ADDRESS=172.16.42.2/24

# Add the docker1 bridge
brctl addbr $SECOND_BRIDGE_NAME

# Set up the IP for the docker2 bridge
ip a add $SECOND_BRIDGE_ADDRESS dev $SECOND_BRIDGE_NAME

# Activate the bridge
ip link set $SECOND_BRIDGE_NAME up
~~~


-- 
Kenjiro NAKAYAMA <nakayamakenjiro at gmail.com>
GPG Key fingerprint = ED8F 049D E67A 727D 9A44  8E25 F44B E208 C946 5EB9
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20140412/fc07aedc/attachment.html>


More information about the lxc-users mailing list