How to make containters get IP addresses from LAN and not from the bridge in netplan

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

0
задан 14 May 2020 в 11:38

1 ответ

Решением для меня было использовать следующую конфигурацию:

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

И тогда я мог назначить статический IP-адрес в моем маршрутизаторе, который работал.

0
ответ дан 19 June 2020 в 21:40

Другие вопросы по тегам:

Похожие вопросы: