Network unreachable after adding new bridged interface

I am trying to add new bridged interface in /etc/network/interfaces with following settings on my Ubuntu 18.04 VM while testing LXC containers.

auto br0
iface br0 inet dhcp
bridge_ports eth0
bridge_stp off
bridge_fd 0
bridge_maxwait 0

After starting the br0, VM is not able to access the network. If I comment these and restart the VM then it can access the network.

Update
after ifup br0 DHCP discovery is not working.

Thanks for any help in advance!

Please can you provide your expanded container config using the command:

lxc config show <container> --expanded

lxc config show mutual-burro --expanded
architecture: x86_64
config:
image.architecture: amd64
image.description: ubuntu 18.04 LTS amd64 (release) (20190918)
image.label: release
image.os: ubuntu
image.release: bionic
image.serial: “20190918”
image.version: “18.04”
volatile.base_image: 9ff5784302bfd6d556ac4c4c1176a37e86d89ac4d1aced14d9388919fa58bee8
volatile.eth0.hwaddr: 00:16:3e:c9:d7:d4
volatile.idmap.base: “0”
volatile.idmap.next: ‘[{“Isuid”:true,“Isgid”:false,“Hostid”:231072,“Nsid”:0,“Maprange”:65536},{“Isuid”:false,“Isgid”:true,“Hostid”:231072,“Nsid”:0,“Maprange”:65536}]’
volatile.last_state.idmap: ‘[{“Isuid”:true,“Isgid”:false,“Hostid”:231072,“Nsid”:0,“Maprange”:65536},{“Isuid”:false,“Isgid”:true,“Hostid”:231072,“Nsid”:0,“Maprange”:65536}]’
volatile.last_state.power: RUNNING
devices:
eth0:
name: eth0
nictype: bridged
parent: lxdbr1
type: nic
root:
path: /
pool: default1
type: disk
ephemeral: false
profiles:

  • default
    stateful: false
    description: “”

What is the IP address of lxdbr1 and can you ping it from the container?

Also, what is the output of ip a after adding br0 and bringing it up?

It looks like LXD config is fine, its just that your host bridge on eth0 is not configured correctly.

The fact that eth0 still has an IP looks wrong to me, the IP should be on the bridge, this might be causing the problem.

what can be done to resolve this?

Take a look at this guide using netplan on ubuntu; https://netplan.io/examples#configuring-network-bridges

I updated the netplan as per https://netplan.io/examples#configuring-network-bridges .

etc/network/interfaces
image

etc/netplan/01-network-manager-all.yaml
image

restarted the br0 but same problem again.

ping 8.8.8.8 not working
image

ip a

I’ve tried this on a fresh 18.04 VM and it works:

sudo apt install ifupdown bridge-utils

/etc/network/interfaces

auto lo
iface lo inet loopback

iface enp0s3 inet manual

# Bridge setup
auto br0
iface br0 inet dhcp
        bridge_ports enp0s3

Reboot and I see:

ip a

2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master br0 state UP group default qlen 1000
    link/ether 08:00:27:76:da:6e brd ff:ff:ff:ff:ff:ff
    inet6 fe80::a00:27ff:fe76:da6e/64 scope link 
       valid_lft forever preferred_lft forever
3: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 08:00:27:76:da:6e brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.129/24 brd 192.168.1.255 scope global br0
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fe76:da6e/64 scope link 
       valid_lft forever preferred_lft forever

I wouldn’t suggest mixing netplan and interfaces files though, stick with one or the other.

Hi @tomp
I am able to solve the bridge interface problem. now i wanted to have lxd container with static ip. and the container would be using the bridge interface br0.

Can I modify container-> ./etc/network/interfaces or netplan to set static ip which uses bridged interface br0 of host? can you share detail which i need to fill in these files?
Note - Now I am using old network configuration ./etc/network/interfaces in host machine .

@girish.meena LXD will not modify any config files inside your container for you (as they can vary from distro to distro).

Although LXD has a static IP option for bridged network types, this only works when using the local DHCP server managed by LXD on the host, as it sets up static DHCP allocations for the container’s MAC address (so the container is still using DHCP but gets given the same IP every time).

But as you are aiming to bridge your container onto the host’s physical network, it will not be using LXD’s managed DHCP server.

However you could use a similar technique and setup a static DHCP allocation in your network’s main DHCP server for the container’s MAC address.

Alternatively you can modify the config files directly inside the container to assign a static IP address. Another option I believe you can use is cloud-init, for which LXD can support injecting initial first-boot config options.

Another option you could use if you do not need the container to talk to the host is to use the ipvlan type nic device, as that allows statically configured IPs from LXD and will appear directly onto the network by sharing the host’s MAC address:

https://linuxcontainers.org/lxd/docs/master/containers#nictype-ipvlan

I was able to solve the problem using below url. In my case dhcp was not setting up ip and static ip were need to assign manually.


This changes done by this does not reflect on interfaces file but doing it in /etc/network/interfaces should also work.