Software & AppsOperating SystemLinux

Configuring wpa_supplicant in Ubuntu Server 20.04 for Wireless Networking

Ubuntu 20

In this article, we will walk you through the process of configuring wpa_supplicant in Ubuntu Server 20.04 for wireless networking. This guide is intended for system administrators and other IT professionals who need to set up a wireless connection on an Ubuntu Server.

Quick Answer

To configure wpa_supplicant in Ubuntu Server 20.04 for wireless networking, you can use the netplan network management tool. Simply edit the netplan configuration file, specifying the wireless interface, SSID, and password, and then apply the changes using the netplan commands.

Introduction

wpa_supplicant is a software application that acts as the supplicant in the Wi-Fi Protected Access (WPA) protocol. It’s used to authenticate wireless networks and manage network connections. In Ubuntu Server 20.04, wpa_supplicant is integrated into the netplan network management tool, which we will use to configure our wireless network.

Checking Your Network Interface

Before we begin, we need to know the name of our wireless interface. You can find this by running the following command:

ip link

This command lists all network interfaces on your system. The wireless interface usually starts with ‘wlp’ or ‘wlx’. Make note of this for later use.

Configuring Netplan

Ubuntu Server 20.04 uses netplan as the default network management tool. Netplan reads network configuration from /etc/netplan/, where you will find a YAML file. The name of this file may vary, but you can check it with the following command:

ls /etc/netplan

Let’s assume the file name is “01-netcfg.yaml”. We will use this file to configure our wireless network. Open this file with a text editor, such as nano:

sudo nano /etc/netplan/01-netcfg.yaml

Replace the existing content with the following, making sure to replace “wlx—–” with your wireless interface name, and “network_ssid_name” and “**********” with your network’s SSID and password, respectively:

network:
 version: 2
 renderer: networkd
 wifis:
 wlx-----:
 dhcp4: yes
 dhcp6: yes
 access-points:
 "network_ssid_name":
 password: "**********"

In this configuration:

  • version: 2 specifies the netplan configuration version.
  • renderer: networkd tells netplan to use networkd as the backend network renderer.
  • dhcp4: yes and dhcp6: yes enable DHCP for IPv4 and IPv6, respectively.
  • access-points specifies the access points that this Wi-Fi device should connect to.

Save the changes and exit the text editor (Ctrl+O, Enter, Ctrl+X).

Applying the Configuration

After editing the netplan configuration file, we need to apply the changes. This can be done with the following commands:

sudo netplan generate
sudo netplan apply
  • sudo netplan generate generates the necessary configuration files for the renderer from the netplan configuration file.
  • sudo netplan apply applies the configuration, establishing the network connection.

Conclusion

That’s it! You have now configured wpa_supplicant in Ubuntu Server 20.04 for wireless networking. Remember that while we used netplan in this guide, wpa_supplicant can also be configured directly by creating a configuration file at /etc/wpa_supplicant/wpa_supplicant.conf. However, this is not the recommended approach for Ubuntu Server.

For more information on netplan or wpa_supplicant, you can check their official documentation at Netplan and wpa_supplicant, respectively.

What is wpa_supplicant?

wpa_supplicant is a software application that acts as the supplicant in the Wi-Fi Protected Access (WPA) protocol. It is used to authenticate wireless networks and manage network connections.

How do I find the name of my wireless interface in Ubuntu Server?

You can find the name of your wireless interface by running the command ip link in the terminal. The wireless interface usually starts with ‘wlp’ or ‘wlx’.

What is netplan?

Netplan is the default network management tool in Ubuntu Server 20.04. It reads network configuration from /etc/netplan/ and allows you to configure network settings using YAML files.

How do I open the netplan configuration file?

You can open the netplan configuration file using a text editor like nano. Run the command sudo nano /etc/netplan/01-netcfg.yaml to open the file.

How do I apply the netplan configuration changes?

After editing the netplan configuration file, you need to apply the changes by running the commands sudo netplan generate and sudo netplan apply in the terminal.

Can I configure wpa_supplicant directly without using netplan?

Yes, you can configure wpa_supplicant directly by creating a configuration file at /etc/wpa_supplicant/wpa_supplicant.conf. However, using netplan is the recommended approach for Ubuntu Server.

Leave a Comment

Your email address will not be published. Required fields are marked *