0

Given the following:

Router <-----> Server [with multiple LXD containers]

How does one configure netplan so that:

  • All LXD containers use Router's DHCP for IP addresses [i.e. bridge acts like a dumb switch]
  • Server uses Router's DHCP for IP address [router allocates static IP of 192.168.1.64]

This:

network:
  version: 2
  renderer: networkd
  ethernets:
    enp0s31f6:
      dhcp4: no
  bridges:
    npbr0:
      interfaces:
        - enp0s31f6
      dhcp4: yes

is close except:

  • LXD containers use bridge's DHCP and not Routers
  • Server gets IP from the bridge

Here is how it used to be done under Network Manager

  • The directions you link to for setting this up with Network Manager look correct, and the netplan config you've provided for setting up the bridge on the host looks correct. After setting up the bridge, did you follow the rest of the instructions regarding configuring the lxd profile? You say "lxd containers use bridge's DHCP and not router's", but if lxd is configured correctly it is not providing a dhcp server on the bridge. – slangasek May 14 at 13:53
  • @slangasek - thanks I think I figured it out - they are mostly correct. I found the solution on Archlinux - ip addr add dev npbr0 192.168.1.64/24 and a restart - which fixed things for me. – TrevTheDev May 15 at 1:48
  • I'm glad you were able to get it working, but this shows that you're setting a static IP address when you said your goal was to configure one with DHCP from the router. Maybe you need to look at why the router is not assigning an IP? If you decide to just use a statically configured IP on the bridge, you can do that through netplan using addresses:. – slangasek May 16 at 7:14
  • @slangasek, thanks again for the advise. I found the solution was to match on macaddress and then add that mac address to the bridge as well using macaddress: – TrevTheDev May 17 at 9:07
0

The solution for me was to use the following config:

network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      dhcp4: no
      dhcp6: no
      match:
        macaddress: 70:...
  bridges:
    br0:
      interfaces:
        - eth0
      dhcp4: yes
      dhcp6: no
      macaddress: 70:...

And then I could assign a static IP in my router which worked.

| improve this answer | |
  • Looks good! Note that you should not have to use the mac address in a match: rule on the physical interface, it should work without, letting you save some duplication in the config. – slangasek May 18 at 16:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.