1

Hay! I searched a lot, but it seems this is not common issue. Comments are much appreciated!

# Set variables
HOST=192.168.0.254
LXC=192.168.0.105

I am dealing with LXC (NGINX, MySQL) and I am not able to access the NGINX websites from my host over the local network (browser):

ERR_ADDRESS_UNREACHABLE

There is no ping from the $HOST to its $LXC container:

3 packets transmitted, 0 received, 100% packet loss, time 2040ms

On the other hand the $HOST is reachable from the $LXC:

3 packets transmitted, 3 received, 0% packet loss, time 2045ms

The host has the lxdbr0 bridge device, through which the LXC containers connect to the local network. Not sure if the containers connect to the local network through this device tho. Example of the network interface configuration on one LXC - /etc/sysconfig/network-scripts/ifcfg-eth0:

DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
HOSTNAME=LXC_NAME
NM_CONTROLLED=no
TYPE=Ethernet
MTU=
DHCP_HOSTNAME=`hostname`

2 Answers 2

0

Common pitfall when working with Virtualization: Do you use something like VirtualBox for your LXC host? Then you have to allow Promiscuous mode for the network interface of the host. Otherwise tenant traffic from the LXC container will be rejected.

Please be more specific with $HOST and $LXC. Is $HOST the IP of the LXC host or your PC with browser? Is $LXC the IP of the LXC host or the IP of the LXC container?

11
  • My host is Ubuntu 16.04 and I am not running VirtualBox, but the native LXC service. $HOST and $LXC are the IP addresses of the host and the container respectively, set at the beginning of my post. Indeed $HOST is the IP of the PC with browser, from which I would like to access the web server on the container. Jul 15, 2018 at 21:36
  • What is your LXD bridge configuration? Please add it to your post: lxc network show lxdbr0. Do you have a virtual or physical LXC host?
    – J. Pee
    Jul 16, 2018 at 11:56
  • The LXC host is physical machine. Seems that there is no network lxc command: $ lxc network show lxdbr0 error: unknown command: network My LXC version: $ lxc --version 2.0.11 Jul 16, 2018 at 13:06
  • Well, that suprises me. Do you use LXD or low level LXC? Were does your lxdbr0 bridge come from if you are not using LXD? Did you change the name? The default LXC bridge is called lxcbr0 Please also provide your container config: /var/lib/lxc/CONTAINER/config
    – J. Pee
    Jul 16, 2018 at 21:53
  • It seems I have the LXD service. I thought I had LXD, but removed it and I suppose the lxd bridge was left over. /var/lib/lxd/containers$ /etc/init.d/lxd status ● lxd.service - LXD - main daemon Loaded: loaded (/lib/systemd/system/lxd.service; indirect; vendor preset: enabled) Active: active (running) since Tue 2018-07-17 16:12:07 EEST; 6min ago The /var/lib/lxc directory does not exist. Jul 17, 2018 at 13:19
0

I managed to resolve this by reconfiguring LXD so my containers can connect to the lxdbr0 instead of directly to my host's local network (the router).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .