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

Guido Jäkel G.Jaekel at DNB.DE
Sat Apr 12 08:02:05 UTC 2014


Dear Kenjiro,

i politely, but strongly suggest you to first read some basics about the TCP/IP  stack like networks, packet routing etc. to learn about the meaning of the term "gateway", especial the "default gateway".

Because the fist answer would be that you of course can't have more than one default route per stack and the advanced answer would be, that you may set up routing namespaces to archive it nevertheless to realize some very special usecases. But for this, in the first you have to understand the common cases in deep.

greetings 

Guido


On 2014-04-12 05:38, Nakayama Kenjiro wrote:
> 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 impossible configuration or lxc's bug?
> Please tell me if anybody can figure out the cause of this problem.
> 
> Thank you in advance.
> 
> Kenjiro
> 
> [1]
>      +-----------------+ Default GW
>      | +-------------+ | +-------+
>      | |    eth0     | | |  br1  |
>      | |172.16.42.20 |-|-|docker1|--
>      | +-------------+ | +-------+
>      |                 |
>      |                 | Default GW
>      | +-------------+ | +-------+
>      | |    eth1     | | |  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
> ~~~
> 
> 
> 
> 
> _______________________________________________
> lxc-users mailing list
> lxc-users at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users
> 



More information about the lxc-users mailing list