The iwconfig command is used to provide wireless NIC configurations, including settings like SSID, encryption information, etc. To connect to a wired network, we simply assign an IP address and subnet mask with the ifconfig utility. A wireless network connection requires the iwconfig and iwlist utilities.
Syntax
The syntax of the iwconfig command is:
# iwconfig [options] [interface]
iwconfig Command Options
The following table describes some common iwconfig command options:
Option | Used To |
---|---|
nick {name} | Set a nickname for the NIC. |
mode {mode} | Set the operating mode for the NIC that corresponds to the network topology. |
freq {number} | Set the Wi-Fi frequency used by the NIC |
channel {number} | Set the Wi-Fi channel used by the NIC. |
retry {number} | Set the maximum number of MAC retransmissions for the NIC. |
If you encounter the below error while running the iwconfig command:
iwconfig: command not found
you may try installing the below package as per your choice of distribution:
OS Distribution | Command |
---|---|
Debian | apt-get install wireless-tools |
Ubuntu | apt-get install wireless-tools |
Alpine | apk add wireless-tools |
Arch Linux | pacman -S wireless_tools |
Kali Linux | apt-get install wireless-tools |
Fedora | dnf install wireless-tools-1 |
Raspbian | apt-get install wireless-tools |
iwconfig Command Examples
1. Show the parameters and statistics of all the interfaces:
# iwconfig
2. Show the parameters and statistics of the specified interface:
# iwconfig interface
3. Set the ESSID (network name) of the specified interface (e.g. eth0 or wlp2s0):
# iwconfig interface new_network_name
4. Set the operating mode of the specified interface:
# iwconfig interface mode ad hoc|Managed|Master|Repeater|Secondary|Monitor|Auto
5. To configure Eth1 to operate in monitor mode, type this:
# iwconfig eth1 mode monitor