How to configure a VLAN

Generate a VLAN connection profile on a live host

Let’s configure NetworkManager to add a VLAN interface on top of the eth0 device with a VLAN ID = 1

Example: generate a VLAN connection profile with nmcli

  1. # nmcli connection add type vlan vlan.id 1 vlan.parent eth0

Example: retrieve VLAN connection profile keyfile content

  1. # cat /etc/NetworkManager/system-connections/vlan.nmconnection
  2. [connection]
  3. id=vlan
  4. uuid=7a9908f4-bed9-4401-8de4-4e7631b5d39e
  5. type=vlan
  6. [ethernet]
  7. [vlan]
  8. flags=1
  9. id=1
  10. parent=eth0
  11. [ipv4]
  12. method=auto
  13. [ipv6]
  14. addr-gen-mode=stable-privacy
  15. method=auto
  16. [proxy]

Elemental MachineRegistration with VLAN injected cloud-config

Example: MachineRegistration with injected VLAN connection profile

  1. apiVersion: elemental.cattle.io/v1beta1
  2. kind: MachineRegistration
  3. metadata:
  4. name: fire-nodes
  5. namespace: fleet-default
  6. spec:
  7. config:
  8. cloud-config:
  9. users:
  10. - name: root
  11. passwd: root
  12. write_files:
  13. - content: |
  14. [connection]
  15. id=vlan
  16. uuid=7a9908f4-bed9-4401-8de4-4e7631b5d39e
  17. type=vlan
  18. [vlan]
  19. flags=1
  20. id=1
  21. parent=eth0
  22. [ipv4]
  23. method=auto
  24. [ipv6]
  25. addr-gen-mode=stable-privacy
  26. method=auto
  27. path: /etc/NetworkManager/system-connections/vlan.nmconnection
  28. permissions: 600
  29. [...]