TP-Link TL-WDN3200 N600 Wireless Dual Band USB Adapter in Linux

TP-Link-TL-WDN3200-N600-Wireless-Dual-Band-USB-Adapter-in-Linux-blackMORE-Ops.jpgI’ve got this TP-Link TL-WDN3200 N600 Wireless Dual Band USB Adapter and I’ve been trying to make it work in Kali Linux which is a Debian derivative. I managed to find the Linux driver DPO_RT5572_LinuxSTA_2.6.1.3_20121022.tar.bz2 from http://www.mediatek.com/. The instructions were very clear but when I tried to compile I received an compile error “make: *** /lib/modules/3.7-trunk-amd64/build: No such file or directory. Stop.“. Following is how to re-produce and fix this error.

Plug-in the USB Adapter

Issue the following command which lists all plugged in USB devices.

root@oracle:~# lsusb 
Bus 001 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 148f:2870 Ralink Technology, Corp. RT2870 Wireless Adapter
Bus 002 Device 003: ID 148f:5572 Ralink Technology, Corp. 
root@oracle:~#

Download driver and unpack it.

root@oracle:~# tar xvf DPO_RT5572_LinuxSTA_2.6.1.3_20121022.tar.bz2
root@oracle:~# cd Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022/
root@oracle:~/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022# ls
chips    iwpriv_usage.txt  rate_ctrl          RT2870STA.dat             tools
common   Makefile          README_STA_usb     sta
include  os                RT2870STACard.dat  sta_ate_iwpriv_usage.txt

Modify makefile

In Makefile

root@oracle:~/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022# leafpad Makefile

set the "MODE = STA" in Makefile and chose the TARGET to Linux by set "TARGET = LINUX".
You can modify more to meet your need.

Modify config.mk file

In os/linux/config.mk

root@oracle:~/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022# leafpad os/linux/config.mk

2 Options:

** Build for being controlled by NetworkManager or wpa_supplicant wext functions
Please set ‘HAS_WPA_SUPPLICANT=y’ and ‘HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=y’.
=> #>cd wpa_supplicant-x.x
=> #>./wpa_supplicant -Dwext -ira0 -c wpa_supplicant.conf -d
** Build for being controlled by WpaSupplicant with Ralink Driver
Please set ‘HAS_WPA_SUPPLICANT=y’ and ‘HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=n’.
=> #>cd wpa_supplicant-0.5.7
=> #>./wpa_supplicant -Dralink -ira0 -c wpa_supplicant.conf -d

In my case, I choose y and y for both.

Complile code

Now lets try to compile using make command.

root@oracle:~/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022# make
make -C tools
make[1]: Entering directory `/root/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022/tools'
gcc -g bin2h.c -o bin2h
make[1]: Leaving directory `/root/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022/tools'
/root/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022/tools/bin2h
cp -f os/linux/Makefile.6 /root/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022/os/linux/Makefile
make -C /lib/modules/3.7-trunk-amd64/build SUBDIRS=/root/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022/os/linux modules
make: *** /lib/modules/3.7-trunk-amd64/build: No such file or directory.  Stop.
make: *** [LINUX] Error 2

This is where I got the error:

make: *** /lib/modules/3.7-trunk-amd64/build: No such file or directory.  Stop.
make: *** [LINUX] Error 2

Determine headers

To fix this error we need to install correct headers as you can see the compiler is looking into the following directory /lib/modules/3.7-trunk-amd64/build
Following command will list available headers

root@oracle:~/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022# aptitude search `uname -r`
p   linux-headers-3.7-trunk-amd64                 - Header files for Linux 3.7-trunk-amd64
i A linux-image-3.7-trunk-amd64                   - Linux 3.7 for 64-bit PCs              
p   linux-image-3.7-trunk-amd64-dbg               - Debugging symbols for Linux 3.7-trunk-amd64                             
v   linux-latest-modules-3.7-trunk-amd64          -                                       
v   linux-modules-3.7-trunk-amd64                 -                                       
p   xen-linux-system-3.7-trunk-amd64              - Xen system with Linux 3.7 on 64-bit PCs (meta-package)

Now let’s install the correct headers using the following command

root@oracle:~/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022# apt-get install linux-headers-$(uname -r|sed 's,[^-]*-[^-]*-,,')
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  linux-headers-3.7-trunk-amd64 linux-headers-3.7-trunk-common linux-kbuild-3.7
The following NEW packages will be installed:
  linux-headers-3.7-trunk-amd64 linux-headers-3.7-trunk-common linux-headers-amd64 linux-kbuild-3.7
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 4,671 kB of archives.
After this operation, 30.0 MB of additional disk space will be used.
Do you want to continue [Y/n]? Y
.
.
.
.
.
<truncated>
.
.
.

Setting up linux-headers-3.7-trunk-common (3.7.2-0+kali8) ...
Setting up linux-kbuild-3.7 (3.7.1-1~experimental.1+kali2) ...
Setting up linux-headers-3.7-trunk-amd64 (3.7.2-0+kali8) ...
Setting up linux-headers-amd64 (3.7+46+kali1) ...

That looks good. Now we should be able to compile the code

Compile code – Take 2

Issue make command to complile source codes

root@oracle:~/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022# make
make -C tools
make[1]: Entering directory `/root/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022/tools'
gcc -g bin2h.c -o bin2h
make[1]: Leaving directory `/root/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022/tools'
/root/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022/tools/bin2h
cp -f os/linux/Makefile.6 /root/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022/os/linux/Makefile
make -C /lib/modules/3.7-trunk-amd64/build SUBDIRS=/root/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022/os/linux modules
make[1]: Entering directory `/usr/src/linux-headers-3.7-trunk-amd64'
.
.
.
.
.
<truncated>
.
.
.
.
.
make[1]: Leaving directory `/usr/src/linux-headers-3.7-trunk-amd64'
cp -f /root/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022/os/linux/rt5572sta.ko /tftpboot
root@oracle:~/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022#

Thats looks better. Now we can try to actually use the driver.

Copy drivers

Copy the driver to /etc/Wireless/RT2870STA

root@oracle:~/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022# mkdir -p /etc/Wireless/RT2870STA/
root@oracle:~/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022# cp RT2870STA.dat /etc/Wireless/RT2870STA/

Load driver module

Plugin the USB Adapter now if you haven’t already and load driver

root@oracle:~/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022# insmod os/linux/rt5572sta.ko

Set interface up

Set interface up and you might need to restart Network Manager

root@oracle:~/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022# ifconfig ra0 inet up
root@oracle:~/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022# service network-manager restart

Unload driver module

To unload driver, unplug the USB Adapter and

root@oracle:~/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022# rmmod rt2870sta

That makes TP-Link TL-WDN3200 N600 Wireless Dual Band USB Adapter work in linux.

Thanks for reading.

Check Also

Enabling AMD GPU for Hashcat on Kali Linux: A Quick Guide

Enabling AMD GPU for Hashcat on Kali Linux: A Quick Guide

If you’ve encountered an issue where Hashcat initially only recognizes your CPU and not the …

Boot Ubuntu Server 22.04 LTS from USB SSD on Raspberry Pi 4

Boot Ubuntu Server 22.04 LTS from USB SSD on Raspberry Pi 4

This is a guide for configuring Raspberry Pi4 to boot Ubuntu from external USB SSD …

15 comments

  1. I already edited the two options ‘y’ and ‘n’ as stated, but I am not sure about:
    ifeq ($(HAS_NATIVE_WPA_SUPPLICANT_SUPPORT),y)
    WFLAGS += -DNATIVE_WPA_SUPPLICANT_SUPPORT
    endif

    At ifeq(… Must I replace ‘y’ to ‘n’?

  2. Very new but persistent in this after hours looking to understand the two lines:

    => #>cd wpa_supplicant-x.x

    => #>./wpa_supplicant -Dwext -ira0 -c wpa_supplicant.conf -d

    In the first line command the folder wpa_supplicant doesnt exist (result ERROR), I used 'find' command to look for wpa.supplicant.conf file , and it is in /lib/live/mount/rootfs/filesystem.squashfs/etc/dbus-1/system.d, so I tried to run the second line and another ERROR. Clearly I missed something but I do know what do next, please help!

    Running the exercise in last version of Kali Linux in a stick USB bootable

    • I don’t use Bootable USB due to persistence issues and many missing files. However, saying all that, please try playing with thes settings in the following file:

      leafpad os/linux/config.mk

      Try using y and n for those two options and which one works out for you. In my case y and y for both options worked.

      • Thanks for your assistance? You right i restarted pc and the files edited doest exist, so all again. I have set to 'y' and 'n'.

        Now the two lines. What to do ? Are they actually terminal command? . I stuck in this two lines, shame on me.

        => #>cd wpa_supplicant-0.5.7

        => #>./wpa_supplicant -Dralink -ira0 -c wpa_supplicant.conf -d

      • Hi again,

        Here is the last section output after run command 'make' co compile the changes, at that moment the two lines:
        => #>cd wpa_supplicant-0.5.7
        => #>./wpa_supplicant -Dralink -ira0 -c wpa_supplicant.conf -d
        was not considered as I read on google it is executed when you run 'make' command, probably I am wrong.

        /root/DPO_RT5572_LinuxSTA_2.6.1.3_20121022/os/linux/../../os/linux/rt_linux.c: In function ‘__RtmpOSFSInfoChange’:
        /root/DPO_RT5572_LinuxSTA_2.6.1.3_20121022/os/linux/../../os/linux/rt_linux.c:1141:20: error: incompatible types when assigning to type ‘int’ from type ‘kuid_t’
        /root/DPO_RT5572_LinuxSTA_2.6.1.3_20121022/os/linux/../../os/linux/rt_linux.c:1142:20: error: incompatible types when assigning to type ‘int’ from type ‘kgid_t’
        make[4]: *** [/root/DPO_RT5572_LinuxSTA_2.6.1.3_20121022/os/linux/../../os/linux/rt_linux.o] Error 1 
        make[3]: *** [_module_/root/DPO_RT5572_LinuxSTA_2.6.1.3_20121022/os/linux] Error 2
        make[2]: *** [sub-make] Error 2
        make[1]: *** [all] Error 2
        make[1]: Leaving directory `/usr/src/linux-headers-3.12-kali1-amd64'
        make: *** [LINUX] Error 2 
  3. I already edited the two options 'y' and 'n' as stated, but I am not sure about:

    ifeq ($(HAS_NATIVE_WPA_SUPPLICANT_SUPPORT),y)

    WFLAGS += -DNATIVE_WPA_SUPPLICANT_SUPPORT

    endif

    At ifeq(… Must I replace 'y' to 'n'?

    • Did you check the README file? I can't remember on top of my head what the options are. .

      • I am reading README. Now I have more doubts than before, the readme file said that:

        -"The driver is for rt2870.o/rt2870.ko ". But it is clear that we are using RT5572, so is it matter?

        -"Supporting kernel: linux kernel 2.4 and 2.6 series". But mine looks

        root@kali:~# cat /proc/version

        Linux version 3.12-kali1-amd64 (debian-kernel@lists.debian.org) (gcc version 4.7.2 (Debian 4.7.2-5) ) #1 SMP Debian 3.12.6-2kali1 (2014-01-06)

        Again is it a problem?

  4. Nope. I got the same. Their README is bit cluttery, but it explains a lot. I had to try few different Y N combination before mine worked.

  5. Hi , i have some issues with your installation in my kali kernel 3.14 .
    I have been looking for a solution for this for some days , and then i found that you made a webpage with instructions how to install the ra2870 or ra3070 .
    i downloaded that file from mediatek because it also have the driver for my ra3070 , but i am running some issues where you told to check config.make in another user .

    first the errors i get are :
    /root/Downloads/DPO_RT5572_LinuxSTA_2.6.1.3_20121022/os/linux/../../os/linux/rt_linux.c:1141:20: error: incompatible types when assigning to type ‘int’ from type ‘kuid_t’
    /root/Downloads/DPO_RT5572_LinuxSTA_2.6.1.3_20121022/os/linux/../../os/linux/rt_linux.c:1142:20: error: incompatible types when assigning to type ‘int’ from type ‘kgid_t’
    make[4]: *** [/root/Downloads/DPO_RT5572_LinuxSTA_2.6.1.3_20121022/os/linux/../../os/linux/rt_linux.o] Error 1
    make[3]: *** [_module_/root/Downloads/DPO_RT5572_LinuxSTA_2.6.1.3_20121022/os/linux] Error 2
    make[2]: *** [sub-make] Error 2
    make[1]: *** [all] Error 2
    make[1]: Leaving directory `/usr/src/linux-headers-3.14-kali1-686-pae’
    make: *** [LINUX] Error 2

    i checked your config , and on this instructions :
    => #>cd wpa_supplicant-x.x
    => #>./wpa_supplicant -Dwext -ira0 -c wpa_supplicant.conf -d

    directory wpa_supplicant does not exist on this package .
    so i try instead :
    ./wpa_supplicant -Dwext -ira0 -c wpa_supplicant.conf -d

    i used :

    wpa_supplicant -Dwext -ira0 -c wpa_supplicant.conf -d

    and i got :

    Initializing interface ‘ra0’ conf ‘wpa_supplicant.conf’ driver ‘wext’ ctrl_interface ‘N/A’ bridge ‘N/A’
    Configuration file ‘wpa_supplicant.conf’ -> ‘/root/Downloads/DPO_RT5572_LinuxSTA_2.6.1.3_20121022/wpa_supplicant.conf’
    Reading configuration file ‘/root/Downloads/DPO_RT5572_LinuxSTA_2.6.1.3_20121022/wpa_supplicant.conf’
    Failed to read or parse configuration ‘/root/Downloads/DPO_RT5572_LinuxSTA_2.6.1.3_20121022/wpa_supplicant.conf’.
    Failed to add interface ra0
    : Cancelling scan request
    : Cancelling authentication timeout

    witch is logical because that file does not exists on the directory .

    you have solution for my error ?
    thank you for all your help and for the excellent website .

  6. I hope someone sees this post on an old article and replys but I am having the same errors in the “make” portion of this guide as HBond10 posted about 5 comments down. I tried every combination on “y” and “n” in config.mk with no luck (n in wpa and y in native seems to bring the error out much earlier in the prosess if that means anything.) I am running with a “Live” install on usb and the author did mentoin there being missing files in this addition that could make this a pain but I have not had any problems with my persistence partition if there is an easy way to add these files I wouldn’t be against it. I don’t want to deal with VMs as they sound like a pain for something like this. If I go dual-boot would this not be such a headache?

    I should add that the Rosewill RNX-N600UBEs they’re selling at Amazon come with Ralink 5572s now so someone looking for a plug-and-play option will be disappointed, and frustrated, and praying that someone will see this comment on a half-year old article and give them a little help.

    Great website by the way! I have been using it almost exclusively to setup kali linux and this is the first guide that gave me any trouble.

    • Hi PG,

      Been a while I used that card or written this guide. I didn’t realize people would actually follow my personal blog …

      I still have that card and will install these drivers again just to make sure the above instructions are still relevant for Kali v.1.0.9a or higher.

      BTW, thanks for your comment regarding Rosewill RNX-N600UBE. I’ve updated the list for Recommended USB cards for Kali and added you as the contributor.

      Will get back on TP-Link card soon. Thanks,
      -BMO

  7. (IK i am asking 2 years too late)
    isn’t the chip in this adapter rt5572 ? why cant we just use the rt2800usb driver? i was thinking about buying this adapter to use it for packet injection but your blog seem to be the only online documentation mentioning kali and the wdn3200 in the same page!
    so is this a valid choice to use with aircrack-ng? does it support packet injection? and can it just run with the rt2800usb driver?
    i hope you still see this 2 years later : and thanks in advance

    • Hello,
      I don’t have that card anymore so can’t comment with confidence. But based on the info I found in Wikidevi; you could try any of these drivers:
      Probable Linux driver
      1. rt2800usb (since kernel v3.10,in backports) or
      2. rt5572sta
      Let me know if this works, might come in handy for someone else. Cheers,
      -BMO

Leave your solution or comment to help others.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from blackMORE Ops

Subscribe now to keep reading and get access to the full archive.

Continue reading

Privacy Policy on Cookies Usage

Some services used in this site uses cookies to tailor user experience or to show ads.