Home > Network Management > iwconfig

iwconfig: Wireless Network Interface Configuration

The iwconfig command is used in Linux to set and display parameters of wireless network interfaces. You can check or change wireless-related information such as Wi-Fi card name, ESSID, frequency, mode, bit rate, and encryption key.

Overview

iwconfig is a utility used to check or change the current settings of wireless network interfaces. It primarily manages wireless-related parameters such as ESSID, channel, mode (Managed, Ad-hoc, Master, etc.), bit rate, and encryption key.

Key Features

  • Display wireless network interface information
  • Set wireless parameters like ESSID, channel, and mode
  • Support for setting WEP encryption keys
  • Useful for older wireless devices and specific scenarios

Main Options

The iwconfig command is used to change or display various settings for a specific wireless interface. Most setting changes require root privileges.

Display Information

Change Settings

Generated command:

Try combining the commands.

Description:

`iwconfig` Executes the command.

Combine the above options to virtually execute commands with AI.

Usage Examples

Various examples of managing wireless network interfaces using the iwconfig command.

Check Information for All Wireless Interfaces

iwconfig

Displays the current settings for all wireless network interfaces present on the system.

Check Information for a Specific Interface (wlan0)

iwconfig wlan0

Displays detailed information for a specified wireless interface (e.g., wlan0).

Set Wireless Network ESSID

sudo iwconfig wlan0 essid "MyWiFiNetwork"

Sets the ESSID of the wlan0 interface to 'MyWiFiNetwork'. This operation requires root privileges.

Set Interface Mode to Managed

sudo iwconfig wlan0 mode Managed

Sets the operating mode of the wlan0 interface to 'Managed' (connection to an AP).

Set Wireless Channel

sudo iwconfig wlan0 channel 6

Sets the operating channel of the wlan0 interface to 6.

Set WEP Encryption Key

sudo iwconfig wlan0 key 0123-4567-89

Sets a hexadecimal WEP encryption key for the wlan0 interface. WEP is insecure and not recommended for use.

Installation

iwconfig is part of the `wireless-tools` package and may not be installed by default on some modern Linux distributions. You can install it using the following commands.

Debian/Ubuntu Based Systems

sudo apt update && sudo apt install wireless-tools

Installs the `wireless-tools` package using the apt package manager.

CentOS/RHEL/Fedora Based Systems

sudo yum install wireless-tools
# or
sudo dnf install wireless-tools

Installs the `wireless-tools` package using the yum or dnf package manager.

Tips & Precautions

Useful tips and points to be aware of when using iwconfig.

Modern Alternative: `iw` Command

iwconfig is considered an older tool. For modern wireless devices and WPA/WPA2/WPA3 encryption settings, using the `iw` command is more recommended. `iw` offers more powerful and flexible features.

  • `iw` is a modern alternative to `iwconfig`.
  • For WPA/WPA2/WPA3 encryption settings, use `wpa_supplicant` or `nmcli`.

Root Privileges Required

Most iwconfig setting changes require root privileges because they modify the system's network configuration. Therefore, you must prefix the command with `sudo`.

  • Using `sudo` is mandatory for configuration changes.

Security Warning: WEP Encryption

iwconfig supports WEP encryption settings, but WEP is highly insecure and strongly discouraged. Use WPA2 or WPA3 encryption whenever possible.

  • WEP can be easily decrypted, so avoid using it.
  • Always use strong encryption like WPA2/WPA3.

Conflict with Network Managers

If a high-level network management service like NetworkManager is running, directly changing settings with iwconfig may cause conflicts or prevent changes from persisting. In such cases, it's recommended to disable NetworkManager or use its management tools.

  • If NetworkManager is active, consider using `nmcli` or `nmtui`.
  • It's advisable to stop network management services before manual configuration.


Same category commands