Three ways to set wireless interface to Monitor mode and Managed mode
You can use the following command to set wireless interface to Monitor mode and Managed mode on any Linux distro. The only requirement is availability wireless adapter that supports monitor mode. This one is recommended.
1. How to enable monitor mode using iw
You should check whether the operating system is able to recognize your Wi-Fi card. In addition, you need to know the name of the wireless interface.
Get to know the wireless interface name:
sudo iw dev
Output:
phy#0 Interface wlan0 ifindex 3 wdev 0x1 addr 3a:c9:39:0d:fc:1a type managed txpower 20.00 dBm
As you can see, the name of my wireless interface is wlan0. In addition, you can see that it is in managed mode.
To set wireless interface to Monitor mode with iw you can use the following command sequence:
sudo ip link set IFACE down sudo iw IFACE set monitor control sudo ip link set IFACE up
Where IFACE replace with actual name of your wireless interface. In may example:
sudo ip link set wlan0 down sudo iw wlan0 set monitor control sudo ip link set wlan0 up
Then check the status of you wireless interface one more time:
sudo iw dev phy#0 Interface wlan0 ifindex 3 wdev 0x1 addr 16:30:78:80:a3:26 type monitor channel 1 (2412 MHz), width: 20 MHz (no HT), center1: 2412 MHz txpower 20.00 dBm
As you can see, now type monitor. Note: the name of interface is not changed by this method.
To return wireless interface in Managed mode with iw you can use the following command sequence:
sudo ip link set IFACE down sudo iw IFACE set type managed sudo ip link set IFACE up
Where IFACE replace with actual name of your wireless interface. In may example:
sudo ip link set wlan0 down sudo iw wlan0 set type managed sudo ip link set wlan0 up
2. How to enable monitor mode using Airmon-ng
Again, we should get information about our wireless interface:
sudo airmon-ng
Output:
PHY Interface Driver Chipset phy0 wlan0 rt2800usb Ralink Technology, Corp. RT3572
The name of interface is wlan0.
Checking for interfering processes
Before putting a card into monitor mode, it will automatically check for interfering processes. It can also be done manually by running the following command:
sudo airmon-ng check
This command stops network managers then kill interfering processes left:
sudo airmon-ng check kill
At last, we start monitor mode:
sudo airmon-ng start wlan0 PHY Interface Driver Chipset phy0 wlan0 rt2800usb Ralink Technology, Corp. RT3572 (mac80211 monitor mode vif enabled for [phy0]wlan0 on [phy0]wlan0mon) (mac80211 station mode vif disabled for [phy0]wlan0)
As you can see, it created a monitor mode interface called wlan0mon.
sudo iwconfig wlan0mon IEEE 802.11 Mode:Monitor Frequency:2.457 GHz Tx-Power=20 dBm Retry short limit:7 RTS thr:off Fragment thr:off Power Management:off lo no wireless extensions. eth0 no wireless extensions.
Disable monitor mode
sudo airmon-ng stop wlan0mon PHY Interface Driver Chipset phy0 wlan0mon rt2800usb Ralink Technology, Corp. RT3572 (mac80211 station mode vif enabled on [phy0]wlan0) (mac80211 monitor mode vif disabled for [phy0]wlan0mon)
Don't forget to restart the Network Manager. It is usually done with the following command:
sudo systemctl start NetworkManager
3. How to enable monitor mode using iwconfig
As usual, start from checking interface name:
sudo iwconfig lo no wireless extensions. eth0 no wireless extensions. wlan0 IEEE 802.11 ESSID:off/any Mode:Managed Access Point: Not-Associated Tx-Power=20 dBm Retry short limit:7 RTS thr:off Fragment thr:off Encryption key:off Power Management:off
The network interface with wireless extension is called wlan0.
Enable monitor mode:
sudo ifconfig IFACE down sudo iwconfig IFACE mode monitor sudo ifconfig IFACE up
Actual example:
sudo ifconfig wlan0 down sudo iwconfig wlan0 mode monitor sudo ifconfig wlan0 up
Disable monitor mode:
sudo ifconfig wlan0 down sudo iwconfig wlan0 mode managed sudo ifconfig wlan0 up
NetworkManager prevents monitor mode
If NetworkManager restarts automatically after each kill, and it pretends monitor mode, you can stop it manually:
In Kali Linux, BlackArch, Ubuntu, Linux Mint:
sudo systemctl stop NetworkManager
Note: when you stop NetworkManager, your Internet access disappears!
Related articles:
- BoopSuite is an alternative to Airodump-ng, Airmon-ng and Aireplay-ng (66.8%)
- How to decrypt WPA traffic in Wireshark (66.8%)
- New Kismet version (66.8%)
- How to hack Wi-Fi with a regular adapter without monitor mode (66.8%)
- Wi-Fi device tracking (66.8%)
- WiFi-autopwner: script to automate searching and auditing Wi-Fi networks with weak security (RANDOM - 23.4%)
At sudo ifconfig IFACE down: IFACE: ERROR while getting interface flags: No such device
I'm trying to enable the mode monitor in the wireless adapter. I did these:
And its alternative:
It worked for 2 seconds, but the wireless adapter restarted and change its mode to managed again before I was able to perform the next steps for packet forwarding, arpspoofing and capture packets with Wireshark.
After those steps above, I've tried sudo network-manager stop to stop nw to restart, but then I can't capture TCP/UCP/HTTP with Wireshark as I wished. Wireshark captured only WLAN packets.
I'm using Kali Rolling 2019.4 in Lenovo E320.
What did I do wrong? Help!
guys all the three methods works on my system man ! great work its easy to go on monitor mode
While using the monitor mode my internet is not active. But I can search devices using this command (airodump-ng wlan0)
Is there anyone, who can help me?