[Lxc-users] question about bridged networking

Fang Matthew jia.fang at volvo.com
Tue Oct 11 09:12:43 UTC 2011


Hello

When I do bridge in Linux machine, the br interface will get the ip address to represent your guest PC. Then you bridge your VPS to br interface to let the network work.

/Matthew

From: Jun Yang [mailto:jyang825 at gmail.com]
Sent: 2011年9月18日 12:20
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<mailto: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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20111011/b1935d86/attachment.html>


More information about the lxc-users mailing list