[Lxc-users] Two virtual interfaces in a container

Serge E. Hallyn serge.hallyn at canonical.com
Tue Oct 19 22:03:26 UTC 2010


Quoting Serge E. Hallyn (serge.hallyn at canonical.com):
> Quoting Nirmal Guhan (vavatutu at gmail.com):
> > 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
> 
> If you want eth1 to be connected internally only, then shouldn't
> you create a bridge br1, and use that here?  Don't connect br1
> to the physical nic, and you'll have your host-only bridge.

(BTW, I assume that the reason you failed to ping then was that
your eth1 in the container had an address on a different subnet,
and - I assume - there was no route known on the host to that
subnet.  I could be wrong, but since your test seemed to be
unrelated to your end goal I thought I'd comment first on how
to do what you want)

-serge




More information about the lxc-users mailing list