[Lxc-users] Dynamically binding physical nic to container

Serge Hallyn serge.hallyn at ubuntu.com
Mon May 20 13:22:57 UTC 2013


Quoting Ajith Adapa (ajith.adapa at gmail.com):
> Hi,
> 
> Is it possible bind a physical NIC to a running container without stopping
> it ?
> 
> Currently based on the configuration in config file interfaces are created
> inside a container

Technically no they are created on the host and passed into the
container.

> and linked to a physical nic in host machine. Let us say
> my host machine has physical nics eth0 and eth1. When I started the
> container it has configuration only for linking up with eth0 via bridge
> mode. Now I want to bind the eth1(host machine) interface to the same
> running container. Is it possible ?

Yes.  The simpler way is to use lxc-device to pass it in, using
	lxc-device -n container add eth1 eth1

 Or you can always using 'ip'.  Use lxc-info to get the init pid of the
 container, then do
 	ip link set eth0 netns <initpid>




More information about the lxc-users mailing list