Bridge with Netplan (For LXC) doesn't work


(Sébastien Bergevin) #1

Hello,

I’m trying to do something that I already did in the past with ubuntu 16.x when it was using ifupdown.
I’m not really a Linux guy and for what I try to do if I could configure a LXC docker instead of a VM I would probably be able to save 90% on ram Ressource.

Anyway, so apparently in ubuntu 17.x they changed ifupdown for Netplan. I need to give to all my docker an IP in the same range of my host which in my case is the network 192.168.124.0/23

At first I tried to follow this guide how to configure the bridge interface and it didn’t work at all :
https://netplan.io/examples

The interfaces is showing up, but I lost all connection (I can’t ping internet, my local network, etc)

If some could help me with this problem, because I’m starting to become crazy :frowning:

This is the config file that I made for /etc/netplan/*.yaml

network:
  version: 2
  renderer: networkd
  ethernets:
    ens160:
      dhcp4: no
      dhcp6: no
  bridges:
      lxdr0:
        dhcp4: no
        interfaces: [ens160]
        addresses: [192.168.124.105/23]
        gateway4: 192.168.124.1
        nameservers:
          addresses: [8.8.8.8]
        parameters:
          stp: false
          forward-delay: 0

I have installed bridge-utils

If someone can help me figuring out why is not working

Just clarify I have all the required space in my original file


(Turtle0x1) #2

What init options did you use with lxd ? Did you specifiy to use your own bridge or the lxdbridge ? (and then preced to create this beidge?)

I have the same setup (less the bridge params) and it should be fine


(Sébastien Bergevin) #3

For now It is not installed. Maybe that’s why it’s not working, not in my souvenir I didn’t need to have any lxd/lxc to configure a bridge.

With these settings when I enter “netplan apply” everything seems fine if I look to the ip configuration with the command “ip a”, but I’m not able to ping anything except myself.

Do I have to enable something like packet forwarding?

If it’s important I’m not on a barebone server, but in a VMware Esxi host. The Ubuntu installed is Ubuntu server with the cloud settings for management.( For example to change my hostname I had to enter something in the config file to not reset the hostname everytime I reboot)


(Vudududu) #4

Hi, one of mine server netplan config:

network:
ethernets:
    eno1:
        dhcp4: false
    eno2:
        addresses: []
        dhcp4: false
    eno3:
        addresses: []
        dhcp4: true
        optional: true
    eno4:
        addresses: []
        dhcp4: true
        optional: true
bridges:
    br0:
        interfaces: [eno1]
        dhcp4: false
        addresses: [IP/24]
        gateway4: GATEWAY IP
        nameservers:
            addresses:
            - DNS IP
            - DNS IP
            search: []
    br1:
        interfaces: [eno2]
        dhcp4: false
        addresses: [IP/16]
version: 2

netplan generate
netplan apply

As log as ip and nic name is good you shloud be all ok. 18.04 work by default, do not know 17.10 since it’s not LTS.


(Sébastien Bergevin) #5

I’m not at work right now, but I will try it again in my homelab.

Really wierd, last time I tried it in my homelab I got an issue with all my network once I entered apply. My home router stopped working. I had to shutdown the VM and reset my home router.

It’s been 2 year’s that I didn’t really use Linux so I’m a bit out of my comfort zone (pretty funny because before working in IT I was a bit more knowledgeable about Linux then windows). I will try again with a fresh new VM, read a bit of documentation and see if I’m able to make it work.

Thanks for the responding, I will update later after I tried again.


#6

There should be some option in VMware called Allow promiscuous or similar.
If it worked earlier without that, then disregard.


(Turtle0x1) #7

I had to enable promiscuous mode on the network adapter also there is a guide on vmware pubs here your bridge configuration is almost indentical to mine which works (on a VM on esxi)


(Sébastien Bergevin) #8

Awsome!!!

It was my vswitch which refused promiscuous mode.
At first I tried to enable the option, but I was still not working until I remark that the changed has still not be made…

Really appreciated the help that you have provided. I had totally forget to look at my network on my hypervisor if the promiscuous mode was enabled or not.