
Wireless adapter setup and configuration
Now that we have installed Kali Linux on our VM, it is time to talk about the wireless adapter configuration. However, first let's take a look at its requirements.
Requirements of the wireless adapter
The main requirements that a wireless adapter must meet to be suitable for wireless penetration testing are:
- Compatibility with the IEEE 802.11b/g/n Wi-Fi standards and possibly also with 802.11a, which operates on the 5 GHz band (dual-band support).
- The capability to put the card in the so-called monitor mode, which allows to sniff all the wireless traffic. The monitor mode is equivalent to the promiscuous mode in wired networks.
- The capability to support packet injection to actively inject traffic into the network.
To verify that our Wi-Fi adapter satisfies these requirements, we first need to determine its chipset and verify that its Linux drivers support both monitor mode and packet injection. We will see how to practically test whether our adapter meets these requirements later in this chapter.
Note
Verifying the adapter chipset compatibility
Great resources to determine the chipset and verify its compatibility are the Tutorial: Is My Wireless Card Compatible? and the Compatibility_drivers sections on the Aircrack-ng documentation wiki (see the reference section of Chapter 2, Setting Up Your Machine with Kali Linux, in Appendix, References).
They provide a detailed list of chipsets and their levels of support for wireless penetration testing.
If our laptop isn't very old, it is almost certainly equipped with an internal Wi-Fi card. Internal cards are usually not the best choice for wireless penetration testing because most of their chipsets are not supported on Kali Linux for this purpose. Moreover, we can't use an internal card within a virtual machine because we need direct access to the device for it to work and virtual machines allow direct access to USB devices only. Thus, if Kali Linux is running on a virtual machine, we can only use USB wireless adapters.
For these reasons, the recommended choice is to use an USB wireless adapter with an external high-gain antenna, which has more transmit power and sensitivity than integrated antennas and thus allows long range signal receiving and transmitting.
An adapter that has these features, is well supported by Kali Linux, is cheap, and therefore very popular among wireless penetration testers is the Alfa Networks AWUS036NH USB card. This card has a Ralink chipset. Other chipsets that are well supported under Linux are the Atheros and the Realtek RTL8187L chipsets.
Through the rest of the book, we will assume that you are using an USB wireless adapter.
Wireless card configuration
After connecting our adapter to the USB port, we have to configure it to be used within our virtual machine with Kali Linux installed.
- We start the VirtualBox VM Manager, select our Kali Linux VM on the left pane, and navigate to Settings | USB. First, we should enable the USB 2.0 controller, if we haven't enabled it already. This requires having the VirtualBox Extension Pack installed (for more information, see the Installing the VirtualBox Extension Pack information box).
- We click on the add a new USB device filter (the green plus icon) on the right and select the device that corresponds to our wireless adapter:
Note
Installing the VirtualBox Extension Pack
We can download the Extension Pack from https://www.virtualbox.org/wiki/Downloads selecting the appropriate file according to the installed VirtualBox version.
Information about the VirtualBox Extension Pack and how to install it is available at https://www.virtualbox.org/manual/ch01.html#intro-installing.
- We start our VM that should now be able to use our wireless adapter via its USB pass-through capability. After the Kali Linux within the VM has booted, we log in to the system as root and open the terminal emulator. We type the
iwconfig
command to list all the wireless interfaces available on our system:The system has assigned our adapter the
wlan0
interface, but it is still not active, as we can see from theifconfig
output: - To bring the
wlan0
interface up, we execute theifconfig wlan0 up
command and thenifconfig
to verify that it has been activated. Now, our wireless interface is up and running, as we can notice in the following screenshot:
Testing the adapter for wireless penetration testing
Now that we have set up the adapter, we can run a little test to verify that it is really suitable for wireless penetration testing, that is, it can be put in monitor mode and it supports packet injection. To do so, we use two programs from the Aircrack-ng suite that will also be extensively used through the rest of the book.
First, we execute airmon-ng start wlan0
to put the interface in monitor mode.
If the command completes successfully and the monitor mode is enabled on the newly created interface mon0
, it means that it has passed this test!
Next, we run the aireplay-ng -9 wlan0
command, where the -9
option means that it is an injection test (the full form is --test
):
Aireplay-ng is a tool designed to generate and inject frames and we will use it to conduct many of the attacks that we will cover in the book.
If the Injection is working!
string appears in the output, then the test is successful and our adapter supports packet injection!
The test provides other valuable information as well; it tells us the channel that the wireless interface is using and the access points that it found through responses to the broadcast probes or received beacons and the relative connection qualities (we will treat these topics in Chapter 3, WLAN Reconnaissance).
More information about the injection test can be found at http://www.aircrack-ng.org/doku.php?id=injection_test.
Troubleshooting
As we have seen, the Kali Linux distribution supports a wide range of wireless adapters and we should not have any problems in configuring our wireless adapter.
However, sometimes our adapter does not show up on the iwconfig
output. In this case, we could check the output of the lsusb
or lspci
tools (depending on the interface type) to see if the device has been detected by the operating system and the output of dmesg
to check whether the relative drivers have been loaded correctly.
At other times, it could happen that the wireless adapter is recognized but the ifconfig wlan0 up
command fails to bring the interface up, with the error message 'SIOCSIFFLAGS : No such file or directory'
. This error usually indicates that the driver could not load the adapter firmware because it is missing or not correctly installed.
We can solve this issue by installing the correct firmware that could be identified on the documentation of the adapter driver.
For example, to install the firmware package for a Ralink chipset adapter, we execute the following command:
apt-get install firmware-ralink
For more detailed information about wireless adapter configuration troubleshooting, some useful references can be found in Appendix, References.