suse-edge / nm-configurator

NetworkManager configuration tool
Apache License 2.0
7 stars 3 forks source link

Add support for VLAN based interfaces #46

Closed e-minguez closed 6 months ago

e-minguez commented 6 months ago

Use case: Use nmc's EIB to deploy a cluster where hosts are connected via VLANs

Currently it seems nmc asumes single MAC per NIC, where for VLAN cases, the VLAN connection uses the MAC address from the underlying network interface.

interfaces:
  - name: ens1f1
    type: ethernet
    state: down
    mac-address: 8c:dc:xx:xx:xx:14
    ipv4:
      enabled: false
      dhcp: false
  - name: ens1f0
    type: ethernet
    state: up
    mac-address: 8c:dc:xx:xx:xx:10
    ipv4:
      enabled: true
      dhcp: true
  - name: floating
    type: vlan
    state: up
    vlan:
      base-iface: ens1f0
      id: 1365
    ipv4:
      dhcp: true
      enabled: true

This is handled by nmc but:

Mar 13 10:12:59 edgelab-hpa3s2.prv.example.com combustion[1608]: + ./nmc apply --config-dir /tmp/nmc/generated
Mar 13 10:12:59 edgelab-hpa3s2.prv.example.com combustion[1608]: [2024-03-13T14:12:59Z INFO  nmc::apply_conf] Identified host: hpa3s2
Mar 13 10:12:59 edgelab-hpa3s2.prv.example.com combustion[1608]: [2024-03-13T14:12:59Z INFO  nmc::apply_conf] Copying file... "/tmp/nmc/generated/hpa3s2/floating.nmconnection"
Mar 13 10:12:59 edgelab-hpa3s2.prv.example.com combustion[1608]: [2024-03-13T14:12:59Z INFO  nmc::apply_conf] Copying file... "/tmp/nmc/generated/hpa3s2/ens1f1.nmconnection"
Mar 13 10:12:59 edgelab-hpa3s2.prv.example.com combustion[1608]: [2024-03-13T14:12:59Z INFO  nmc::apply_conf] Copying file... "/tmp/nmc/generated/hpa3s2/ens1f0.nmconnection"
Mar 13 10:12:59 edgelab-hpa3s2.prv.example.comt combustion[1608]: [2024-03-13T14:12:59Z INFO  nmc::apply_conf] Using name 'floating' for interface with MAC address '8c:dc:xx:xx:xx:10' instead of the preconfigured 'ens1f0'
Mar 13 10:12:59 edgelab-hpa3s2.prv.example.com combustion[1608]: [2024-03-13T14:12:59Z INFO  nmc] Successfully applied config

And then:

hpa3s2:~ # find /etc/NetworkManager/system-connections/
/etc/NetworkManager/system-connections/
/etc/NetworkManager/system-connections/floating.nmconnection
/etc/NetworkManager/system-connections/ens1f1.nmconnection