GekBuzz

Answers, Explainers & Everyday Guides

How to Configure WiFi on Linux Mint Without GUI Step-by-Step

How to Configure WiFi on Linux Mint Without GUI Step-by-Step

Configuring WiFi on Linux Mint without using a graphical user interface (GUI) allows you to connect to wireless networks directly from the terminal. This is especially useful for servers, minimal installations, or when the desktop environment is unavailable or unresponsive. This guide walks you through the process of connecting to WiFi using command-line tools, ensuring you can get online even without GUI support.

What You’ll Need

  • A Linux Mint system with a compatible wireless network interface card (NIC)
  • Access to the terminal with sudo or root privileges
  • The SSID (network name) and password of the WiFi network you want to connect to
  • Basic familiarity with Linux command-line operations

Step-by-Step

  1. Open the Terminal. You can access the terminal via Ctrl+Alt+T or by switching to a virtual console with Ctrl+Alt+F1 through F6.
  2. Check your wireless interface name. Run ip link or iwconfig to list network interfaces. Wireless interfaces typically have names like wlan0, wlp2s0, or similar.
    ip link
    # or
    iwconfig

    Identify your wireless interface name for use in subsequent commands.

  3. Ensure wireless interface is up. Bring the interface up if it’s down:
    sudo ip link set interface-name up

    Replace <interface-name> with your wireless interface name.

  4. Scan for available WiFi networks. Use sudo iwlist <interface-name> scan to see nearby wireless networks and their details.
    sudo iwlist wlp2s0 scan

    Look for your network’s SSID in the output.

  5. Create a WPA supplicant configuration file. This file contains your network credentials and encryption details.

    You can generate it using wpa_passphrase:

    wpa_passphrase <SSID> <password> | sudo tee /etc/wpa_supplicant.conf

    For example:

    wpa_passphrase MyNetwork MySecretPassword | sudo tee /etc/wpa_supplicant.conf

    This command creates or overwrites /etc/wpa_supplicant.conf with the proper configuration.

  6. Connect to the WiFi network using wpa_supplicant.

    Run:

    sudo wpa_supplicant -B -i <interface-name> -c /etc/wpa_supplicant.conf

    The -B option runs it in the background, -i specifies the interface, and -c points to the config file.

  7. Obtain an IP address via DHCP. After authentication, request an IP address:
    sudo dhclient <interface-name>

    This step connects your system to the network and assigns an IP address.

  8. Verify the connection. Check your IP address and connectivity:
    ip addr show <interface-name>
    ping -c 3 8.8.8.8

    Successful pings confirm network access.

  9. Optional: Set up auto-connection on boot. To connect automatically on startup, add the wpa_supplicant and DHCP commands to a network initialization script or use systemd services.

    Alternatively, configure NetworkManager or other network services to manage connections without GUI, but this guide focuses on manual CLI setup.

Common Mistakes

  • Using incorrect interface names: Modern Linux systems often use predictable network interface names like wlp3s0 instead of wlan0. Using the wrong name causes commands to fail.
  • Not running commands with sudo or root privileges: Many networking commands require elevated permissions.
  • Misconfiguring the wpa_supplicant.conf file: Incorrect SSID or password entries will prevent authentication.
  • Skipping the DHCP step: Without obtaining an IP address, you won’t have network access even if authenticated.
  • Forgetting to bring the interface up: If the wireless interface is down, scanning or connecting won’t work.

Tips

  • Keep your wireless drivers updated: Ensure your system has the latest drivers for your wireless card to avoid hardware compatibility issues.
  • Use nmcli for easier CLI management: NetworkManager’s command-line tool nmcli can simplify wireless setup and connection management without GUI.
  • Secure your wpa_supplicant.conf file: Since it contains your WiFi password, restrict permissions using sudo chmod 600 /etc/wpa_supplicant.conf.
  • Test connectivity with both IP and DNS: Ping a known IP (like 8.8.8.8) and a domain (like google.com) to verify full network functionality.
  • Use verbose output for troubleshooting: Add -d or -dd flags to wpa_supplicant for detailed debug information.

Troubleshooting

If your WiFi connection does not work as expected, try these steps:

  • Confirm interface status: Run ip link show <interface-name> to ensure it’s up and not disabled by hardware or software switches.
  • Check for blocked wireless devices: Use rfkill list to see if the wireless device is soft or hard blocked. If blocked, unblock using sudo rfkill unblock wifi.
  • Review wpa_supplicant logs: Stop the background process and run it in the foreground with debug flags:
    sudo wpa_supplicant -i <interface-name> -c /etc/wpa_supplicant.conf -d

    This reveals detailed connection errors.

  • Check DHCP client: If you connect but have no IP address, try renewing it with sudo dhclient -v <interface-name> and watch for errors.
  • Verify wireless network details: Confirm the SSID and password are correct and that the network uses WPA/WPA2 (the most common). Other encryption types may require different configurations.
  • Try connecting to a different network: This can help isolate whether the problem is with your device or the specific WiFi network.
  • Check kernel and driver issues: Consult dmesg for messages related to wireless hardware or firmware failures.

Frequently Asked Questions

Can I use this method for hidden WiFi networks?

Yes. To connect to a hidden network, add scan_ssid=1 under the network block in wpa_supplicant.conf. For example:

network={
  ssid="HiddenNetwork"
  scan_ssid=1
  psk="password"
}

Is wpa_supplicant the only way to connect without GUI?

No. You can also use nmcli, iw combined with dhclient, or configure /etc/network/interfaces for persistent setups. However, wpa_supplicant is widely used and reliable.

How do I disconnect from WiFi using the terminal?

Identify the wpa_supplicant process for your interface and kill it:

sudo pkill -f "wpa_supplicant -i <interface-name>"

Then release the DHCP lease with:

sudo dhclient -r <interface-name>

Why does my WiFi disconnect after reboot?

Because the manual commands aren’t persistent. To enable auto-connect, you must configure system startup scripts, use nmcli with NetworkManager, or set up a systemd service for wpa_supplicant.

Can I connect to WiFi using only iw and dhclient?

Not usually. iw can scan and set parameters but cannot handle WPA/WPA2 authentication. wpa_supplicant is needed for secured networks.

What if my WiFi uses WPA3?

WPA3 support depends on your wpa_supplicant version and wireless drivers. Newer versions support WPA3, but older systems may require updates or fallback to WPA2.

By following these steps and tips, you can confidently connect to WiFi on Linux Mint without relying on a graphical interface, gaining flexibility and control over your network connections.

Related

How to Configure WiFi on Linux Mint Without GUI Step-by-Step

Leave a Reply

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

Scroll to top