Title: MAC Address Gets Disabled: TP-Link TL-WN722N Wireless Adapter in Kali Linux (VirtualBox)
Introduction
In this article, we will discuss a common issue that may arise when using a TP-Link TL-WN722N wireless adapter in Kali Linux, which is running on a VirtualBox virtual machine. Specifically, we will focus on the problem of the MAC address getting disabled and how to solve it.
Background
To start with, let's first define some key concepts:
-
MAC address: A MAC (Media Access Control) address is a unique identifier assigned to a network interface controller (NIC) for use as a network address in communications within a network segment. This address is usually assigned by the manufacturer of the NIC and is stored in the NIC's hardware. -
TP-Link TL-WN722N: This is a popular USB wireless network adapter that can be used with Linux distributions. -
Kali Linux: Kali Linux is a Debian-based Linux distribution that is designed for digital forensics, penetration testing, and network security assessments. -
VirtualBox: VirtualBox is a powerful x86 and AMD64/Intel64 virtualization product for enterprise as well as home use. It is a general-purpose full virtualizer for hardware-assisted and software-only virtualization, running on Windows, macOS, Linux, and Solaris platforms.
Now that we have defined these key terms, let's move on to the problem at hand.
Problem Description
When using the TP-Link TL-WN722N wireless adapter in Kali Linux, which is running in VirtualBox, users may encounter an issue where the MAC address gets disabled. This can be observed by running the ifconfig command in the terminal:
--questionbegin--
type ifconfig starting Kali Linux VirtualBox not assigned MAC address.
See terminal trace.
┌──(root㉿kali)-[/home/kali]└─#ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether 00:00:00:00:00:00 txqueuelen 1000
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
--questionend--
As can be observed from the terminal trace, the MAC address for the wireless adapter (eth0) is set to all zeros (00:00:00:00:00:00). This means that the adapter is not able to communicate on the network as it does not have a unique identifier.
Solution
To solve this problem, follow these steps:
-
Shutdown the Kali Linux virtual machine.
-
In the VirtualBox manager, select the Kali Linux virtual machine and click on the
Settingsbutton. -
In the
Settingswindow, click on thePortstab and then select theUSBoption on the left pane. -
In the
USBtab, make sure that the TP-Link TL-WN722N wireless adapter is selected and then click on theUSB Settingsbutton. -
In the
USB Settingswindow, make sure that theEnable USB Controlleroption is checked and that theUSB 2.0 (EHCI)orUSB 3.0 (xHCI)option is selected, depending on the version of the adapter. -
Check the
Disable this device when the virtual machine is not runningoption. This will ensure that the adapter is not in use by the host operating system when the virtual machine is running. -
Click
OKto close theUSB Settingswindow. -
Click
OKto close theSettingswindow. -
Start the Kali Linux virtual machine.
-
In the Kali Linux terminal, run the
ifconfigcommand again:┌──(root㉿kali)-[/home/kali]└─#ifconfig eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 10.0.2.15 netmask 255.255.255.0 broadcast 10.0.2.255 ether 08:00:27:2b:6d:5c txqueuelen 1000 (Ethernet) RX packets 25 bytes 3852 (3.7 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 19 bytes 2938 (2.8 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0As can be observed from the terminal trace, the MAC address for the wireless adapter (eth0) is now set to a unique value (
08:00:27:2b:6d:5c). This means that the adapter is now able to communicate on the network.
Alternative Solution
An alternative solution to this problem is to manually assign a MAC address to the wireless adapter in Kali Linux. To do this, follow these steps:
-
Shutdown the Kali Linux virtual machine.
-
In the VirtualBox manager, select the Kali Linux virtual machine and click on the
Settingsbutton. -
In the
Settingswindow, click on theSystemtab and then select theMotherboardoption on the left pane. -
In the
Motherboardtab, uncheck theEnable EFI (Special OSes only)option if it is checked. This is necessary because EFI can sometimes prevent the assignment of a static MAC address. -
Start the Kali Linux virtual machine.
-
In the Kali Linux terminal, edit the
/etc/network/interfacesfile:┌──(root㉿kali)-[/home/kali]└─#nano /etc/network/interfaces -
Add the following lines to the end of the file:
auto eth0 iface eth0 inet dhcp hwaddress ether 00:11:22:33:44:55In the above example,
00:11:22:33:44:55is the manually assigned MAC address for the wireless adapter. -
Save and close the file.
-
Restart the networking service:
┌──(root㉿kali)-[/home/kali]└─#systemctl restart networking -
In the Kali Linux terminal, run the
ifconfigcommand to confirm that the wireless adapter now has the assigned MAC address:┌──(root㉿kali)-[/home/kali]└─#ifconfig eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 10.0