diff --git a/source/guides/network/wifi.rst b/source/guides/network/wifi.rst index 93808db8..ba3a8ba5 100644 --- a/source/guides/network/wifi.rst +++ b/source/guides/network/wifi.rst @@ -3,23 +3,29 @@ Configure Wi-Fi ############### -We recommend using `NetworkManager `_ to manage network connections. If you -choose to connect to Wi-Fi while using the -:ref:`live installer ` image, your Wi-Fi settings -will be added to your system during the installation process. +We recommend using `NetworkManager +`_ to +manage wireless network connections. If you choose to connect to Wi-Fi while +using the :ref:`live installer ` image, your Wi-Fi +settings will be added to your system during the installation process. -NetworkManager provides three simple methods for configuring Wi-Fi. +NetworkManager provides three simple methods for configuring Wi-Fi: Desktop, +CLI, and TUI. NetworkManager uses :command:`wpa_supplicant`, which can also be +used on its own for a more lightweight installation. .. contents:: :local: :depth: 1 +Using Network Manager +********************* + Desktop GUI (Graphical User Interface) -************************************** +====================================== 1. Click anywhere on the icons at the right side of the top of the screen to - bring up a menu and click on :guilabel:`Wi-Fi Not Connected` then - choose :guilabel:`Select Network`. + bring up a menu and click on :guilabel:`Wi-Fi Not Connected` then choose + :guilabel:`Select Network`. .. figure:: /_figures/wifi/wifi-1.1.png @@ -43,7 +49,7 @@ Desktop GUI (Graphical User Interface) .. figure:: /_figures/wifi/wifi-5.png CLI (Command Line Interface) -**************************** +============================ #. List the available Wi-Fi networks @@ -73,7 +79,7 @@ CLI (Command Line Interface) To avoid having the Wi-Fi password stored in bash history, consider using the TUI. TUI (Text-based User Interface) -******************************* +=============================== #. Launch the NetworkManager Text User Interface @@ -102,8 +108,184 @@ TUI (Text-based User Interface) .. figure:: /_figures/wifi/nmtui_5.png + +Using wpa_supplicant +******************** + +wpa_suppliant can be used directly, without NetworkManager, to associate a +wireless adapter with an access point. After association is established, an IP +address needs to be assigned or obtained. + + +Associate with a wireless access point +====================================== + +#. Make sure NetworkManager is stopped and disabled by masking the service. + + .. code-block:: bash + + sudo systemctl stop NetworkManager.service + sudo systemctl mask NetworkManager.service + + +#. Stop the wpa_supplicant.service, which may have been started by NetworkManager. + + .. code-block:: bash + + sudo systemctl stop wpa_supplicant.service + +#. Create a ``wpa_supplicant`` configuration directory. + + .. code-block:: bash + + sudo mkdir -p /etc/wpa_supplicant + +#. Determine your wireless interface name. + + .. code-block:: bash + + iw dev + + Use the name following "Interface" on the first line (eg. wlp1s0) + + .. code-block:: console + :emphasize-lines: 1 + + Interface wlp1s0 + ifindex 3 + wdev 0x1 + addr 00:xx:xx:38:34:7a + type managed + txpower 0.00 dBm + + Set the $INTERFACE_NAME environment variable to take advantage of copying + and pasting commands. + + .. code-block:: bash + + export INTERFACE_NAME=wlp1s0 + +#. Create a minimal configuration file called + :file:`/etc/wpa_supplicant/wpa_supplicant-$INTERFACE_NAME.conf` + and add the following: + + .. code-block:: bash + + sudo tee /etc/wpa_supplicant/wpa_supplicant-$INTERFACE_NAME.conf > /dev/null <<'EOF' + ctrl_interface_group=wheel + ctrl_interface=/run/wpa_supplicant + update_config=1 + EOF + +#. Start the wpa_supplicant service to complete the configuration process. + + .. code-block:: bash + + sudo systemctl start wpa_supplicant@$INTERFACE_NAME.service + +#. Use :command:`wpa_cli` (interactive mode) to scan for available networks. + In this example, our network is named *Network1*. + + .. code-block:: bash + :emphasize-lines: 1,2,5,7 + + sudo wpa_cli + > scan + OK + <3>CTRL-EVENT-SCAN-STARTED + <3>CTRL-EVENT-SCAN-RESULTS + > scan_results + bssid / frequency / signal level / flags / ssid + 00:xx:xx:73:7b:46 5180 -55 [WPA2-PSK-CCMP][ESS] Network1 + 00:xx:xx:83:fa:70 5240 -76 [WPA2-EAP-CCMP][ESS] Network2 + 00:xx:xx:4f:e9:2c 2412 -67 [WPA2-PSK-CCMP][ESS][P2P] Printer + 00:xx:xx:af:fe:3e 5765 -79 [WPA2-PSK-CCMP][ESS] Network3 + 00:xx:xx:e9:eb:29 2412 -76 [WPA2-PSK-CCMP][ESS] Network4 + 00:xx:xx:26:4a:b9 2412 -79 [WPA2-PSK-CCMP][ESS][P2P] Printer2 + 00:xx:xx:b9:0d:d4 2462 -79 [WPA2-PSK-CCMP][ESS] Network5 + +#. Set up your network connection replacing *Network1* with your wireless + SSID name and *Network1Password* with the password for your network. + + .. code-block:: bash + :emphasize-lines: 1,3,5,7 + + > add_network + 0 + > set_network 0 ssid "Network1" + OK + > set_network 0 psk "Network1Password" + OK + > enable_network 0 + OK + <3>CTRL-EVENT-SCAN-STARTED + <3>CTRL-EVENT-SCAN-RESULTS + <3>SME: Trying to authenticate with 00:xx:xx:5d:d9:26 (SSID='Network1' freq=5180 MHz) + <3>Trying to associate with 00:xx:xx:5d:d9:26 (SSID='Network1' freq=5180 MHz) + <3>Associated with 00:xx:xx:5d:d9:26 + <3>CTRL-EVENT-SUBNET-STATUS-UPDATE status=0 + <3>WPA: Key negotiation completed with 00:xx:xx:5d:d9:26 [PTK=CCMP GTK=CCMP] + <3>CTRL-EVENT-CONNECTED - Connection to 00:xx:xx:5d:d9:26 completed [id=0 id_str=] + +#. Save the configuration and quit out of :command:`wpa_cli`. + + .. code-block:: bash + + > save_config + OK + > quit + +.. note:: + + The network password is saved as plaintext in + :file:`/etc/wpa_supplicant/wpa_supplicant-$INTERFACE_NAME.conf`. Use + `wpa_passphrase + `_ + for a more secure method. + +Assign an IP address +==================== + +After the wireless adapter has been associated with wireless access point, an +IP address needs to be assigned for access to the network. + +The example below uses ``systemd-networkd`` to request an IP address from the +access point via DHCP. Another network manager can be used if preferred. If +there is a static IP address you'd like to assign, see the +:ref:`assign-static-ip` documentation. + +#. Create the :file:`/etc/systemd/network` directory + + .. code-block:: bash + + sudo mkdir -p /etc/systemd/network + +#. Create a :file:`/etc/systemd/network/25-wireless-$INTERFACE_NAME.network` file + with a Match and Network section. + + .. code-block:: bash + + printf "[Match]\nName=$INTERFACE_NAME\n\n[Network]\nDHCP=ipv4" | sudo tee /etc/systemd/network/25-wireless-$INTERFACE_NAME.network + +#. Restart the ``systemd-networkd.service``. + + .. code-block:: bash + + sudo systemctl restart systemd-networkd.service + + +#. Enable the ``systemd-networkd`` and ``wpa_supplicant`` services to start automatically + on future boots. + + .. code-block:: bash + + sudo systemctl enable --now systemd-networkd.service + sudo systemctl enable --now wpa_supplicant@$INTERFACE_NAME.service + + Other resources *************** * NetworkManager CLI `documentation `_. -* Additional CLI `examples `_. \ No newline at end of file +* Additional CLI `examples `_. +* wpa_supplicant `advanced usage documentation `_