[Lxc-users] Two virtual interfaces in a container

Nirmal Guhan vavatutu at gmail.com
Tue Oct 19 19:34:49 UTC 2010


Hi,

I have a requirement to create two virtual interfaces (eth0, eth1) in
a linux container and separate traffic between the two based on ip
route. Basically eth0 (or eth1) should be used for external world and
eth1 for communication terminating at host. How do I go about doing
this?

I created two interfaces in the config and can see both of them in the
container.

lxc.network.type = veth
lxc.network.link = br0
lxc.network.ipv4 = 128.107.159.183/22
lxc.network.name = eth0
lxc.network.flags = up
lxc.network.mtu = 1500
lxc.network.type = veth
lxc.network.link = br0
lxc.network.ipv4 = 128.107.159.185/22
lxc.network.name = eth1
lxc.network.flags = up

159: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
state UP qlen 1000
161: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
state UP qlen 1000

The problem is using eth1, I cannot ping the default gw.

# ip route show
128.107.156.0/22 dev eth0  proto kernel  scope link  src 128.107.159.183
128.107.156.0/22 dev eth1  proto kernel  scope link  src 128.107.159.185
default via 128.107.159.175 dev eth1  <<< Added host as well in the
route as just adding default gw didn't work
default via 128.107.156.2 dev eth1 << default gw
default via 128.107.156.2 dev eth0

BTW, I run 2.6.32 + fedora 12.

Thanks,
Nirmal




More information about the lxc-users mailing list