[Lxc-users] Making LXC accept an already open network interface—or other options
David Serrano
dserrano5 at gmail.com
Tue May 10 15:34:27 UTC 2011
On Tue, May 10, 2011 at 16:36, Serge Hallyn <serge.hallyn at canonical.com> wrote:
>
> 1. tell it to give you a normal network interface
>
> lxc.network.type=veth
> lxc.network.link=br0
> lxc.network.flags=down
>
> 2. bring up the container
> 3. bring down the normal interface
> 4. Continue here with passing veth1 into the container.
Thank you.
We're almost there. With this configuration, now there's only lo and
eth0 inside the container indeed. Then I:
host# ip link set veth1 netns $pid
container# ip link del eth0
container# ip link set veth1 name eth0
container# ifconfig eth0 10.1.0.253 up
container# ping 10.1.0.101 ## address of br0 in the host
PING 10.1.0.101 (10.1.0.101) 56(84) bytes of data.
>From 10.1.0.253 icmp_seq=1 Destination Host Unreachable
>From 10.1.0.253 icmp_seq=2 Destination Host Unreachable
>From 10.1.0.253 icmp_seq=3 Destination Host Unreachable
If I bring up eth0 before deleting it and putting veth1 in its place,
the network works as expected and I can ping the host's br0. But the
veth1-renamed-to-eth0 doesn't want to work. Interestingly:
container# ifconfig eth0
# ifconfig eth0
eth0 Link encap:Ethernet HWaddr ae:6c:69:6a:f5:08
inet addr:10.1.0.253 Bcast:10.255.255.255 Mask:255.0.0.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
container# ip neigh show
10.1.0.101 dev eth0 FAILED
container# arp -an
? (10.1.0.101) at <incomplete> on eth0
You can see that the packet counts remain at 0.
--
David Serrano
More information about the lxc-users
mailing list