[lxc-users] can't have internet in lxc container

mierdatutis mi mmm286 at gmail.com
Wed Dec 14 12:24:30 UTC 2016


Hi again,

I put the lxc config original file and I have the same problem.

My host have ip by dhcp by wifi and my lan is 192.168.1.0.

I would like to have the container with ip fixed and it is in my lan how
other computer.

If I understand you, to can make these I have to configure with macvlan.
How could I configure these? How could I configure these in the host?

thanks!




---------- Mensaje reenviado ----------
From: "Fajar A. Nugraha" <list at fajar.net>
To: LXC users mailing-list <lxc-users at lists.linuxcontainers.org>
Cc:
Date: Wed, 14 Dec 2016 16:59:52 +0700
Subject: Re: [lxc-users] can't have internet in lxc container
On Wed, Dec 14, 2016 at 3:57 PM, mierdatutis mi <mmm286 at gmail.com> wrote:

> I have a host ubuntu with dhcp and I would like to have a ubuntu guest
> container with ip fixed. I'm trying to set up the /etc/network/interface
> with these conf:
>

Also, I've modified the config file of the ubuntu lxc:
>
> lxc.network.link = lxcbr0
>
>

> lxc.network.ipv4 = 192.168.1.223/24
> lxc.network.ipv4.gateway = 192.168.1.1
>
>
First thing first: you shoud either configure IP address in your container
(e.g. /etc/network/interfaces), or in lxc config file. Not both.

Another thing, is 192.168.1.0/24 the network of your lxc bridge (lxcbr0),
or your LAN?

IIRC lxcbr0 defaults to 10.0.3.0 (at least in did the past). If you want to
put the containers in the same network as your host, macvlan would be the
easiest choice. But it comes with a catch: you container will not be able
to communicate with your host by default, unless your host also use macvlan
interface.

-- 
Fajar

---------- Mensaje reenviado ----------
From: mierdatutis mi <mmm286 at gmail.com>
To: lxc-users at lists.linuxcontainers.org
Cc:
Date: Wed, 14 Dec 2016 09:57:40 +0100
Subject: [lxc-users] can't have internet in lxc container

I have a host ubuntu with dhcp and I would like to have a ubuntu guest
container with ip fixed. I'm trying to set up the /etc/network/interface
with these conf:

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.1.51
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8

Also, I've modified the config file of the ubuntu lxc:

root at clusterb1:/var/lib/lxc/clusterb2# more config
lxc.include = /usr/share/lxc/config/ubuntu.common.conf
lxc.rootfs = /var/lib/lxc/clusterb2/rootfs
lxc.mount = /var/lib/lxc/clusterb2/fstab
lxc.utsname = clusterb2
lxc.arch = amd64
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = lxcbr0
lxc.network.hwaddr = 00:16:3e:90:15:39
lxc.network.ipv4 = 192.168.1.223/24
lxc.network.ipv4.gateway = 192.168.1.1
lxc.start.auto = 0
lxc.loglevel = 0

The problem is when I connect to guest I have ip but I can't do ping to
other ip's like host ip. I says me destitation unreachable

ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
>From 192.168.1.223 icmp_seq=1 Destination Host Unreachable
>From 192.168.1.223 icmp_seq=2 Destination Host Unreachable
>From 192.168.1.223 icmp_seq=3 Destination Host Unreachable

Please any help? Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20161214/bf62ec00/attachment.html>


More information about the lxc-users mailing list