How to configure Wi-Fi

Configure Wi-Fi - 图1important note

This guide describes how to configure Wi-Fi on a freshly installed operating system. For some reasons, like no wired network connection availabe, you may want to also use Wi-Fi when you boot from the ISO.

This is possible by using a cloud-config definition in the SeedImage resource. You can refer to the same instructions as below on how to create it.

Configure Wi-Fi - 图2info

The information on this page is just a specific use case of using cloud-config. For more generic info on how to create arbitrary files check our cloud-config page

Elemental Teal currently uses NetworkManager to manage network connections.

In order to add Wi-Fi to your node, your registration should include a configuration in the cloud-config section to write a .connection file so NetworkManager can connect to the Wi-Fi.

A .connection file is a connection configuration file for NetworkManager. The connection files are stored under /etc/NetworkManager/system-connections/ and can include ethernet, Wi-Fi, VPN and more.

For example for a network with the SSID testSSID and the WPA-PSK key 123456789 and using the interface wlan0 you would write the following .connection file:

  1. [connection]
  2. id=testConnection
  3. type=wifi
  4. interface-name=wlan0
  5. permissions=
  6. timestamp=1671549641
  7. [wifi]
  8. mac-address-blacklist=
  9. mode=infrastructure
  10. ssid=testSSID
  11. [wifi-security]
  12. key-mgmt=wpa-psk
  13. psk=123456789
  14. [ipv4]
  15. dns-search=
  16. method=auto
  17. [ipv6]
  18. addr-gen-mode=stable-privacy
  19. dns-search=
  20. method=auto
  21. [proxy]

Configure Wi-Fi - 图3info

To see all the configurations available for NetworkManager check nm-settings which includes the format of the connection file and all the different options you can use.

Which we should encode to base64 and paste in the content in our registration cloud-config section as such:

wifi cloud config

  1. apiVersion: elemental.cattle.io/v1beta1
  2. kind: MachineRegistration
  3. metadata:
  4. name: my-nodes
  5. namespace: fleet-default
  6. spec:
  7. machineName: name
  8. config:
  9. cloud-config:
  10. write_files:
  11. - encoding: b64
  12. content: W2Nvbm5lY3Rpb25dCmlkPXRlc3RDb25uZWN0aW9uCnR5cGU9d2lmaQppbnRlcmZhY2UtbmFtZT13bGFuMApwZXJtaXNzaW9ucz0KdGltZXN0YW1wPTE2NzE1NDk2NDEKClt3aWZpXQptYWMtYWRkcmVzcy1ibGFja2xpc3Q9Cm1vZGU9aW5mcmFzdHJ1Y3R1cmUKc3NpZD10ZXN0Cgpbd2lmaS1zZWN1cml0eV0Ka2V5LW1nbXQ9bm9uZQp3ZXAta2V5LXR5cGU9MQp3ZXAta2V5MD0xMjM0NTY3ODkxCgpbaXB2NF0KZG5zLXNlYXJjaD0KbWV0aG9kPWF1dG8KCltpcHY2XQphZGRyLWdlbi1tb2RlPXN0YWJsZS1wcml2YWN5CmRucy1zZWFyY2g9Cm1ldGhvZD1hdXRvCgpbcHJveHldCg==
  13. path: /etc/NetworkManager/system-connections/wifi1.connection

This would get the /etc/NetworkManager/system-connections/wifi1.connection file deployed on the node during installation with the connection content and NetworkManager would read and enable the connection on boot.