Debugging default network bridge on HOST not reaching containers

I have a pretty fresh install of LXD v4.14 , and using it via the default networking… I was under the impression that if I am browsing on my host OS where LXD is installed with the IP and port listed in lxc list I shouldn’t need to use port forwarding devices… but when I attempt to hit a website within a container I’m getting blocked.

I can confirm inside the container the webserver is up, running, returning HTML etc…

Did I remember wrong or… is there something wrong with the default bridge I have?

$ lxc network list
+----------+----------+---------+-----------------+------+-------------+---------+
|   NAME   |   TYPE   | MANAGED |      IPV4       | IPV6 | DESCRIPTION | USED BY |
+----------+----------+---------+-----------------+------+-------------+---------+
| enp4s0   | physical | NO      |                 |      |             | 0       |
+----------+----------+---------+-----------------+------+-------------+---------+
| enp5s0f1 | physical | NO      |                 |      |             | 0       |
+----------+----------+---------+-----------------+------+-------------+---------+
| lxdbr0   | bridge   | YES     | 10.XXX.XXX.X/24 | none |             | 9       |
+----------+----------+---------+-----------------+------+-------------+---------+

I was googling around to maybe try my hand finally at creating a proper network where in which LXC/D picks up my home routers DHCP… but it looks like it’s no longer quite valid for Ubuntu 20.04

lots of the steps are just described so I am a little apprehensive … is there a Ubuntu 20.04 version update floating about ?

EDIT: I think I have found a way to try modifying my current bridge… going to give this a go with a slight modification since I am using JUJU and must leave IPv6 off… right?

okay Now I’ve got a new network bridge on one of my ethernet lan ports working (I can browse the web still on the host) but now I am stuck trying to get the bridge into the default profile… seems

$ lxc network list
+----------+----------+---------+-----------------+------+-------------+---------+
|   NAME   |   TYPE   | MANAGED |      IPV4       | IPV6 | DESCRIPTION | USED BY |
+----------+----------+---------+-----------------+------+-------------+---------+
| br0      | bridge   | NO      |                 |      |             | 0       | 
+----------+----------+---------+-----------------+------+-------------+---------+
| enp4s0   | physical | NO      |                 |      |             | 0       |
+----------+----------+---------+-----------------+------+-------------+---------+
| enp5s0f1 | physical | NO      |                 |      |             | 0       |
+----------+----------+---------+-----------------+------+-------------+---------+
| lxdbr0   | bridge   | YES     | 10.204.191.1/24 | none |             | 1       |
+----------+----------+---------+-----------------+------+-------------+---------+
$ lxc profile edit default
Config parsing error: Device validation failed for "eth0": Failed loading device "eth0": Failed to load network "br0" for project "default": No such object
Press enter to open the editor again or ctrl+c to abort change

Tried br0 instead of eth0 and same error

lxc profile edit default
Config parsing error: Device validation failed for "br0": Failed loading device "br0": Failed to load     network "br0" for project "default": No such object
Press enter to open the editor again or ctrl+c to abort change


config: {}
description: Default LXD profile
devices:
  eth0:
    name: eth0
    network: br0
    type: nic
  root:
    path: /
    pool: default
    type: disk
name: default
used_by: []
~                                                                                                                                                     
~                                                                                                                                                     
~

i tried adding macvlan but now thing I need to reinstall from scratch now… as i am reading macvlan containers and host cannot see eachother… and maybe I’ve just gotten a bit too messed up of a network setup

I’ll first try to just uninstall juju, LXD, and lxc

Okay I think I’ve repaired the situation now…

I have a network interface bridge called br0 that holds both my NIC’s… it is successfully feeding my host internet AND the LXD/Juju containers internet

BUT I cannot seem to disable br0’s ipv6 on startup… and I manually have to do this command to get the ipv6 to go away, despite adding what I thought was the same thing to the .conf files

   sudo sysctl -w net.ipv6.conf.br0.disable_ipv6=1

Any idea if I am doing something out of date here? I realize this is not really LXD related so might take this to stackoverflow now but… any help appreciated. I need to likely document fully how I got here as well for my colleagues

$ ifconfig
br0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet6 fe80::3430:e2ff:fef4:a025  prefixlen 64  scopeid 0x20<link>
        ether 24:4b:fe:df:7e:38  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 5  bytes 414 (414.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

after I do that sysctl command I get

$ ifconfig
br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.108  netmask 255.255.255.0  broadcast 192.168.1.255
        ether 24:4b:fe:df:7e:38  txqueuelen 1000  (Ethernet)
        RX packets 1636  bytes 1232962 (1.2 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1658  bytes 353983 (353.9 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

My networks

$ lxc network list
+----------+----------+---------+----------------+------+-------------+---------+
|   NAME   |   TYPE   | MANAGED |      IPV4      | IPV6 | DESCRIPTION | USED BY |
+----------+----------+---------+----------------+------+-------------+---------+
| br0      | bridge   | NO      |                |      |             | 0       |
+----------+----------+---------+----------------+------+-------------+---------+
| enp4s0   | physical | NO      |                |      |             | 0       |
+----------+----------+---------+----------------+------+-------------+---------+
| enp5s0f1 | physical | NO      |                |      |             | 0       |
+----------+----------+---------+----------------+------+-------------+---------+
| lxdbr0   | bridge   | YES     | 10.22.143.1/24 | none |             | 7       |
+----------+----------+---------+----------------+------+-------------+---------+

When I went to lxd init I simply told it to reuse a pre-existing bridge br0 and all seems happy both in lxd and juju

Yes that is right you should be able to access the services running on the internal private IP of the lxdbr0 from the LXD host.

Can you show the output of ip a and ip r inside one of the containers affected, and also on the LXD host itself.

Also can you confirm whether or not you can ping the container’s IP from the LXD host?

I think it’s all working now actually…

I have br0 as the bridge I created using the instructions… and when installing LXD i simply pointed in the installation setup to that bridge… so far I do not explicitly need to change anything on that br0 regarding ipv6… not sure why or why not… but I think this lxbr0 is now pointed to the br0 as a sort of child bridge…

ubuntu@juju-2dd159-4:~$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
14: eth0@if15: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 00:16:3e:3b:60:b0 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 10.22.143.27/24 brd 10.22.143.255 scope global dynamic eth0
       valid_lft 3501sec preferred_lft 3501sec
    inet6 fe80::216:3eff:fe3b:60b0/64 scope link 
       valid_lft forever preferred_lft forever
ubuntu@juju-2dd159-4:~$ ip r
default via 10.22.143.1 dev eth0 proto dhcp src 10.22.143.27 metric 100 
10.22.143.0/24 dev eth0 proto kernel scope link src 10.22.143.27 
10.22.143.1 dev eth0 proto dhcp scope link src 10.22.143.27 metric 100 

Thanks for checking in @tomp … Juju claims not to work with LXD if it uses ipv6 but… so far no problems shrug

thanks for the information.

thanks for the awesome information.