[Lxc-users] question about bridged networking

Jäkel, Guido G.Jaekel at dnb.de
Tue Oct 11 09:07:30 UTC 2011


Dear Jun,

don't assign anything at IP level to eth0, just get it up). But assign the IP ...202 to the bridge. 

You may imagine this as if the bridge (as layer 2 device) connects at this level to the eth0. But your hosts layer 3 IP stack has to be attached to the bridge in the same way as the network cards of the virtual hosts. This will be caused by configuring IP parameters to the bridge's "build-in and auto-attached" ethernet device.

Guido

>-----Original Message-----
>From: Jun Yang [mailto:jyang825 at gmail.com]
>Sent: Sunday, September 18, 2011 6:20 AM
>To: lxc-users at lists.sourceforge.net
>Subject: [Lxc-users] question about bridged networking
>
>Hi all,
>
>I am trying to set up a VPS using LXC 0.7.4.  I want the VPS to have a static IP address on the same subnet as the host.  Here is
>what I have in host (Ubuntu 11.04)'s /etc/network/interfaces:
>
>
>	auto eth0
>	iface eth0 inet static
>	    address 192.168.0.202
>	    netmask 255.255.255.0
>	    gateway 192.168.0.1
>
>	auto br101
>	iface br101 inet static
>	    address 192.168.0.101
>	    network 192.168.0.0
>	    netmask 255.255.255.0
>	    broadcast 192.168.0.255
>	    gateway 192.168.0.1
>	    bridge_ports eth0
>	    bridge_stp off
>	    bridge_maxwait 5
>	    post-up /usr/sbin/brctl setfd br101 0
>
>
>Problem 1, when I reboot the host, the host's br101 get 192.168.0.101 (expected) but eth0 gets no IP address.  I can bring up
>eth0 manually at this point and it gets 192.168.0.202 (expected).  But at this point, 192.168.0.101 is really an IP address of the
>host.  I set up my VPS as:
>
>
>	lxc.network.type = veth
>	lxc.network.flags = up
>	lxc.network.link = br101
>	lxc.utsname = vps101
>
>	lxc.tty = 4
>	lxc.pts = 1024
>	lxc.rootfs = /var/lib/lxc/vps101/rootfs
>	lxc.mount  = /var/lib/lxc/vps101/fstab
>	...
>
>
>I can bring it up.  But when I do "ssh root at 192.168.0.101", I get into host rather than the guest.
>
>How is bridged networking supposed to work in this case?  I thought 192.168.0.101 would be routed to the guest.  Thanks!
>
>Jun



More information about the lxc-users mailing list