[Lxc-users] question about bridged networking

Matthew Franz mdfranz at gmail.com
Tue Oct 11 09:09:26 UTC 2011


Typically you do not assign an address to the physical interface when
you are bridging.

>From host (also on 11.04)

auto eth0
iface eth0 inet manual

# The primary network interface
auto br0
iface br0 inet static
	address 192.168.1.62
	netmask 255.255.255.0
	gateway 192.168.1.1
	bridge_ports eth0
	# dns-* options are implemented by the resolvconf package, if installed
	dns-nameservers 192.168.1.70 192.168.1.1

------
And a container

lxc.network.type=veth
lxc.network.link=br0
lxc.network.flags=up

root at opti620u1104:~# cat /var/lib/lxc/ubuntu1/rootfs/etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
	address 192.168.1.40
	netmask 255.255.255.0
	gateway 192.168.1.1
	dns-nameservers 192.168.1.1


---

On Sun, Sep 18, 2011 at 12:19 AM, Jun Yang <jyang825 at gmail.com> wrote:
> 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
>
> ------------------------------------------------------------------------------
> All the data continuously generated in your IT infrastructure contains a
> definitive record of customers, application performance, security
> threats, fraudulent activity and more. Splunk takes this data and makes
> sense of it. Business sense. IT sense. Common sense.
> http://p.sf.net/sfu/splunk-d2d-oct
> _______________________________________________
> Lxc-users mailing list
> Lxc-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-users
>
>



-- 
--
Matthew Franz
mdfranz at gmail.com




More information about the lxc-users mailing list