[lxc-users] reach the outside world

Serge Hallyn serge.hallyn at ubuntu.com
Fri Mar 13 07:02:54 UTC 2015


Quoting Guillaume VINCENT (gvincent at oslab.fr):
> Hello list,
> 
> I'm learning how to use lxd and play with my container.
> 
> For know I can download images, launch some container.
> 
> But I can't get my container reaching the outside world.
> 
> My host /etc/network/interfaces :

Hi,

Where did you get this information from?  There are a few problems
below.  What is your distribution?  What version of lxc are you
using?  Best would be if you could get lxcbr0 created by lxc itself
(see config/init/common/lxc-net)

> auto lo
> iface lo inet loopback
> 
> # The primary network interface
> auto eth0
> iface eth0 inet dhcp

Here you have eth0 doing dhcp, but you also make it a
bridge-port of lxcbr0 which has a static address.  I suspect
you want to just make it

auto eth0
iface eth0 inet manual

auto lxcbr0
iface lxcbr0 inet dhcp
  bridge_ports eth0

Even so, whether containers get a network address will depend on
how your local network is configured (and it won't work if eth0
is wireless, but I assume it's not)  But that may get you going.

> auto lxcbr0
> iface lxcbr0 inet static
>     address x.x.x.230
>     netmask 255.255.255.0
>     network x.x.x.0
>     broadcast x.x.x.255
>     gateway x.x.x.1
>     bridge_ports eth0
>     bridge_stp off
>     bridge_fd 0
> 
> brctl show
> 
> bridge name	bridge id		STP enabled	interfaces
> lxcbr0		8000.e89a8f509087	no		eth0
> 
> lxc list
> 
> +--------------+---------+-----------+------+
> |     NAME     |  STATE  |   IPV4    | IPV6 |
> +--------------+---------+-----------+------+
> | my_container | RUNNING | 127.0.0.1 | ::1  |
> +--------------+---------+-----------+------+
> 
> 
> lxc config show my_container
> 
> Profiles: default
> 
> lxc config profile edit default
> 
> name: default
> config: {}
> devices:
>   eth0:
>     nictype: bridged
>     parent: lxcbr0
>     type: nic
> 
> 
> lxc exec my_container -- ping 8.8.8.8
> 
> connect: Network is unreachable
> 
> 
> Any idea ? Any ressource I can read ?
> 
> I've read lxc bridge setup post on the mailing list without any success
> 
> Thank you
> 
> 

> _______________________________________________
> lxc-users mailing list
> lxc-users at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users



More information about the lxc-users mailing list