Working with the Linux operating system often requires interacting with the command line, especially when it comes to server solutions or minimalist distributions without a graphical interface. Many users encounter a situation where, after installing the system, there is no graphical shell, and the only way to access the network is through the terminal. Understanding how network utilities work in Linux is a fundamental skill for any system administrator or enthusiast.
There are several time-tested methods for enabling a wireless connection, each with its own advantages depending on the distribution you're using. Modern systems like Ubuntu or Fedora typically rely on NetworkManager, while lighter options might use wpa_supplicant or systemd-networkd. In this article, we'll detail the most effective setup methods so you can choose the best one for your situation.
Before entering commands, you need to ensure that the physical adapter is working properly and the drivers are installed correctly. The lack of a graphical interface doesn't mean network management will be difficult or confusing; on the contrary, console utilities provide more granular control over connection parameters. We'll look at tools that allow you to quickly diagnose problems and restore stable internet access.
Checking the status of the wireless adapter
The first step in the setup process is identifying your network equipment. The system must see the wireless card to manage it. To list all network interfaces and their current status, the utility most often used is ip, which replaced the outdated one ifconfig. Enter the command ip link in the terminal to see the list of available devices.
In the command output, you will notice interface names such as eth0 for wired connection or wlan0, wlp2s0 for wireless adapters. If the interface is marked as DOWN, which means it's disabled by software. It's also important to check whether the required driver is loaded, although in most modern distributions this happens automatically when the kernel boots.
- 🔍 Use the command
lspciorlsusbto check the visibility of the device at the bus level. - 📡 Make sure the wireless network interface is displayed in the list
ip link. - 🚫 If the adapter is not visible, check the physical Wi-Fi switch on the laptop case.
- ⚙️ Some cards may require installing proprietary drivers via a package manager.
⚠️ Important: If you are using a virtual machine, make sure that USB or network adapter forwarding is enabled in the virtualization settings, otherwise the guest OS will not see the Wi-Fi module.
Once the hardware is present, you can proceed to activating the interface. Sometimes it happens that the device is detected but blocked by the software switch. rfkillThis is a built-in Linux security mechanism that can block radio emissions. You can check the status of the blocking with the command rfkill list, and remove them with the command rfkill unblock wifi.
Using NetworkManager (nmcli)
The most universal and convenient tool for network management in modern distributions is NetworkManagerIts console utility nmcli Allows you to perform all necessary actions: from scanning available networks to entering a password and setting up a static IP. This method is preferred for desktop systems where ease and speed of connection are important.
To get started, you need to enable Wi-Fi control and scan the air. Command nmcli radio wifi on activates the module if it was disabled. Then perform a scan using nmcli dev wifi listto see a list of available access points in the area. The list will display the network's SSID, signal strength, and security standard used.
Connecting to a network is accomplished with a single command, specifying the network name and password. The syntax is as follows:
nmcli dev wifi connect "Network_Name" password "Your_Password"
If the connection is successful, the system will automatically obtain an IP address via DHCP and set default routes. If you need to connect to a hidden network, add the flag hidden yes at the end of the command. NetworkManager also saves connection profiles, so when the device is turned on again, the connection will be established automatically.
- 🔑 For WPA3 networks, use the option
wifi-sec.key-mgmt wpa-eapwhen setting manually. - 📝 Connection profiles are stored in
/etc/NetworkManager/system-connections/. - 🔄 You can restart the network service using the command
sudo systemctl restart NetworkManager. - 📶 You can delete your old profile through
nmcli connection delete "Network_Name".
⚠️ Warning: When entering a password on the command line, it may appear in the bash command history. For increased security, use interactive input or special flags to hide arguments.
Configuration via wpa_supplicant
In lighter distributions or server environments where NetworkManager is not used, the primary tool remains wpa_supplicantThis is a daemon that manages connections and ensures traffic encryption. Working with it requires creating a configuration file, making this method slightly more complex, but extremely flexible and independent of heavy services.
The first step is to generate a hashed password for your network so you don't have to store it in plaintext in the configuration file. Use the utility wpa_passphrase, passing it the network name (SSID) and password. The result will be a block of text that needs to be added to the configuration file.
wpa_passphrase"MyWiFi""StrongPassword123"
Copy the resulting output and save it to a file. /etc/wpa_supplicant/wpa_supplicant.conf. The file must contain a block network with parameters ssid And pskAfter editing the file, start the daemon, specifying the interface and path to the configuration. The command typically looks like this: wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf -B.
| Parameter | Description | Example of meaning |
|---|---|---|
| ssid | Wireless network name | "Home_WiFi" |
| psk | Password hash or text | "hashed_value" |
| key_mgmt | Key management type | WPA-PSK |
| proto | Security protocol | RSN |
After successfully associating with the access point, you need to obtain an IP address. This is done using the utility dhclient or dhcpcd, depending on the distribution. Run the command dhclient wlan0, and in a few seconds your computer should have access to the network. You can check the connection with the command ping.
What to do if wpa_supplicant does not start?
Make sure you have superuser privileges (sudo). Also, check the system logs using journalctl -u wpa_supplicant to determine the cause of the error. Often, the problem lies in an incorrect path to the configuration file or insufficient access rights to the device.
Using the iwctl utility
A modern alternative to classical methods is the use of iwd (iNet wireless daemon) and its interactive shell iwctlThis approach is becoming standard in new versions of Arch Linux and other leading distributions. The utility offers a convenient interactive mode, reminiscent of working with the Cisco command line or simple scripts.
To get started, run iwctl as root. Inside the shell, you will see a prompt [iwd]#First, you need to find the available devices with the command device list, then enable scanning for a specific device, for example station wlan0 scanAfter the scan is complete (usually takes a couple of seconds), you can display a list of networks with the command station wlan0 get-networks.
Connection is made by the command station wlan0 connect"SSID"The system will automatically ask for a password if the network is secure. The main advantage iwctl — is its interactivity and the lack of need to manually edit configuration files for one-time connections. All settings are saved automatically in /var/lib/iwd/.
- 🚀 iwd is faster and uses fewer resources than wpa_supplicant.
- 📂 The configuration is stored in binary or text form in the system directory.
- 🔌 Supports automatic reconnection when the connection is lost.
- 🛠 Ideal for minimalist Linux builds.
☑️ Connection algorithm via iwctl
Setting up a static IP address
In some cases, such as for servers or network printers, a static IP address may be required instead of automatically assigned via DHCP. This ensures a consistent address, which is necessary for port forwarding or SSH access. Setting up a static address depends on the network management method chosen above.
If you are using NetworkManager, the easiest way is to create a new connection profile with the required parameters. Command nmcli connection modify Allows you to set the IP address, mask, gateway, and DNS servers. For example, setting the address 192.168.1.50 with a mask of 24 and a gateway of 192.168.1.1 is accomplished through the corresponding parameters. ipv4.addresses And ipv4.gateway.
For systems using netplan (common in Ubuntu Server), the configuration is stored in YAML files in the directory /etc/netplan/. The file is usually called 00-installer-config.yaml or something similar. It should specify the network structure, specifying the renderer (networkd or NetworkManager) and interface parameters.
network:version: 2
ethernets:
eth0:
addresses: [192.168.1.50/24]
routes:
- to: default
via: 192.168.1.1
nameservers:
addresses: [8.8.8.8, 1.1.1.1]
After making changes to the YAML file, you need to apply the configuration with the command netplan applyThe system will check the syntax and activate the new settings. Indentation errors in the YAML file will prevent the network from working, so be careful when editing.
⚠️ Important: When setting up a static IP, make sure the selected address is not in the DHCP pool range of your router, otherwise an address conflict will occur and the connection will be interrupted.
Diagnostics and problem solving
Even with proper configuration, connection issues may still occur. Log analysis should always be your first diagnostic tool. In modern systems with systemd use the command journalctl -u NetworkManager or journalctl -u wpa_supplicantto view the service's event history. Logs often contain the exact reason for the failure, such as "authentication failed" or "no carriers."
If there is a connection, but the Internet does not work, check the routing table with the command ip routeMake sure there is a default route (default via...). It's also worth checking DNS functionality by trying to ping the domain name, for example ping google.comIf the IP can be pinged but the domain can't, the problem is in the DNS settings.
A common problem is a weak signal or interference. Utility iw dev wlan0 link will show the current connection speed and signal strength (RSSI). RSSI values closer to 0 (e.g., -40 dBm) indicate an excellent signal, while values below -80 dBm indicate poor reception. In such cases, changing the channel on the router or using an external antenna may help.
Why are 5 GHz networks not visible?
This may be related to the regional settings of the wireless controller. Check the current region with the command iw reg getIf the wrong country code is set, some channels may be blocked. You can change the region using the command iw reg set US (or your country code), but this requires superuser rights.
How to reset all network settings?
To completely reset NetworkManager settings, you can delete the connection files in /etc/NetworkManager/system-connections/ and restart the service. For wpa_supplicant, simply clear or rewrite the configuration file. This will return the system to its "as is" state after installation.
What to do if the Wi-Fi driver is not working?
Check if the kernel module is loaded with the command lsmod | grep wifi (or part of the driver name). If the module is present but not working, try reinstalling the driver package or updating the system kernel. Some cards (e.g., Broadcom) require separate package installation. broadcom-sta.
Mastering these tools gives you complete control over your Linux network environment. Whether you're working with a powerful server or an old laptop, console commands remain the most reliable way to establish connections. Practice using them. nmcli And iwto feel confident in any situation.