[lxc-users] reach the outside world

Serge Hallyn serge.hallyn at ubuntu.com
Fri Mar 13 14:17:57 UTC 2015


Quoting Guillaume VINCENT (gvincent at oslab.fr):
> Thank you for your answers
> 
> I'm running ubuntu 14.04 on a dedicated server, lxc 0.3 and lxd 0.3
> 
> > auto lo
> > iface lo inet loopback
> > 
> > # The primary network interface
> > auto eth0
> > iface eth0 inet dhcp
> 
> this configuration correspond to my default /etc/network/interfaces on a dedicated server, after a fresh install
> 
> 
> @Serge Hallyn 
> my lxcbr0 bridge was created by lxc itself, the only thing I'm trying do to is to connect this bridge to my eth0

Ok then I think you did too much.  When lxc sets up lxcbr0, it sets up
iptables rules and a dnsmasq so that lxcbr0's traffic is forwarded over
your default link.  You should not make changes to your lxcbr0 (except
by editing variables in /etc/default/lxc-net).  Rather, just create a
new bridge, say br0, the traditional way and then use that for your
containers.

So I'm guessing it's still not working for you because the forwarding
rules are still there.  I think you should remove lxcbr0 from
/etc/network/interfaces and put eth0 back to dhcp.

Otherwise you can create a new bridge, br0, in /etc/network/interfaces,
and use that for your containers.  To use br0 in your lxd containers,
you would do

lxc config profile edit default

and s/lxcbr0/br0/

> so here my new /etc/network/interfaces (thank you, my eth0 should be set to manual, sorry)
> 
> # The loopback network interface
> auto lo
> iface lo inet loopback
> 
> # The primary network interface
> auto eth0
> iface eth0 inet manual
> 
> # LXC bridge
> auto lxcbr0
> iface lxcbr0 inet dhcp
>         bridge_ports eth0
> 
> 
> ifconfig -a
> 
> eth0      Link encap:Ethernet  HWaddr e8:9a:8f:50:90:87  
>           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>           RX packets:1917 errors:0 dropped:7 overruns:0 frame:0
>           TX packets:724 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:0 txqueuelen:1000 
>           RX bytes:167618 (167.6 KB)  TX bytes:79313 (79.3 KB)
>           Interrupt:28 Memory:feae0000-feb00000 
> 
> ...
> 
> lxcbr0    Link encap:Ethernet  HWaddr e8:9a:8f:50:90:87  
>           inet addr:x.x.x.230  Bcast:195.154.5.255  Mask:255.255.255.0
>           inet6 addr: xxxx::xxxx:xxxx:xxxx:xxxx/64 Scope:Link
>           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>           RX packets:1898 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:708 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:0 txqueuelen:0 
>           RX bytes:130809 (130.8 KB)  TX bytes:73009 (73.0 KB)
> 
> 
> lxc list
> 
> root at oslab:~# lxc list
> +--------------+---------+-----------+------+
> |     NAME     |  STATE  |   IPV4    | IPV6 |
> +--------------+---------+-----------+------+
> | my_container | RUNNING | 127.0.0.1 | ::1  |
> +--------------+---------+-----------+------+
> 
> I'm probably missing something
> 
> I'm playing with lxd
> container are new for me
> 
> 
> @Guido
> "I would say that the container don't have an adequate IP. And maybe no default route to your gateway x.x.x.1, too. Should this be set by DHCP or by static configuration?"
> static configuration
>  
> other info for now /var/lib/lxd/lxc/my_container/ does not contain any config file or folder
> 
> root at oslab:~# ls /var/lib/lxd/lxc/my_container/
> log  rootfs
> 
> is it normal ?
> 
> Thank you for your patience
> 
> 
> 
> 

> _______________________________________________
> 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