TRENDnet TEW-421PC H/W:B1 PC Card Wireless Adapter using ndiswrapper Installation

The TEW-421PC is a PC Card 802.11g wireless device that uses the Marvell Technology Group Ltd. 88w8335 [Libertas] 802.11b/g Wireless (rev 03) chipset.

For this example we assume that we are building the device in the user's home directory.

Note: I have only tested this using 128bit (104bit) WEP and ndiswrapper 1.29.

Reference should be make to the ndiswrapper wiki if any doubts exist:

You should test that your device is applicable to this instruction using lspci:

user@ubuntu:~$ lspci

Your output from lspci should contain a line very much like this:

0X:00.0 Ethernet controller: Marvell Technology Group Ltd. 88w8335 [Libertas] 802.11b/g Wireless (rev 03)

This procedure has been tested one time. As soon as I get the chance I will be doing a complete reinstall for verification.

Step 1 - Remove any existing copies of ndiswrapper that you may have

user@ubuntu:~$ ndiswrapper

If you get an error stating that the program is not installed then proceed to the Step 2.

Here is how to remove a copy that was installed using apt-get:

user@ubuntu:~$ sudo apt-get remove ndiswrapper

If you have an existing copy that you installed using make then change to the driver's directory and remove it using make:

user@ubuntu:~$ make uninstall

Run ndiswrapper once more to make sure that you get the not installed error message:

user@ubuntu:~$ ndiswrapper

Step 2 - Disable any Competing Drivers

This section is here for completeness. There are no competing drivers at this time, but this hopefully will change in the future and there will someday be a native driver.

Step 3 - Prepare the Linux build environment

You will need to install the essential build files to compile the driver:

user@ubuntu:~$ sudo apt-get update 
user@ubuntu:~$ sudo apt-get install build-essential

Install the correct headers for your version of Ubuntu: (don't worry if it tells you that yours are up to date.)

user@ubuntu:~$ sudo apt-get install linux-headers-`uname -r` 
user@ubuntu:~$ sudo ln -s /usr/src/linux-`uname -r` /lib/modules/`uname -r`/build

Step 4 - Download the latest version of the ndiswrapper driver

Download the latest version of the ndiswrapper from sourceforge:

At the time I originally wrote this the latest version was 1.29:

It should be noted that as the ndiswrapper is further developed it could be the case that any particular NDIS driver compatibility could become broken for awhile.

Step 5 - Extract and install the ndiswrapper using make

If you downloaded the driver to your Desktop then move it to your home directory. Open the middle menu called "Places" and select "Home Folder", copy the ndiswrapper-1.29.tar.gz file into it.

Using tar extract the archived driver and change directories into the build area.

user@ubuntu:~$ tar xvzf ndiswrapper-1.29.tar.gz 
user@ubuntu:~$ cd ndiswrapper-1.29

Make the driver with the commands "make distclean", "make", and "make install":

user@ubuntu:~/ndiswrapper-1.29$ make distclean
user@ubuntu:~/ndiswrapper-1.29$ make
user@ubuntu:~/ndiswrapper-1.29$ sudo make install

The make process will take several minutes to complete.

You can now check the ndiswrapper to see that it is installed correctly. You should see something similar to:

user@ubuntu:~/ndiswrapper-1.29$ ndiswrapper -v
utils version: 1.9
driver version:        1.29
vermagic:       2.6.17-10-generic SMP mod_unload 586 REGPARM gcc-4.1

Obtain the Windows NDIS drivers that you intend to use with the device. In this case we are going to download the drivers from the TRENDnet site. For another device you should look at the ndiswrapper site's device listing and obtain your drivers from the described location. Or if you only have the install CD you can try to use those drivers, but they may not work.

The driver that we are using can be obtained from TRENDnet:

View download area:

Direct Link to driver:

Our driver file's name is either TEW-421PC_b1\Driver\ or depending upon which link you download it from.

After Downloading the file it will probably be on your desktop. Open the middle menu called "Places" and select "Home Folder", create a directory called tew-421pc and put the file into it.

When we get an archive file from a manufacturer, the following tools may be required to extract the archive:


In this case we are going to use unzip.

Extract the file using unzip:

user@ubuntu:~/ndiswrapper-1.29$ cd ~ 
user@ubuntu:~$ cd tew-421pc
user@ubuntu:~/tew-421pc$ unzip TEW-421PC_b1\\Driver\\ 

Now we can change it to the Drivers/Windows XP directory and install the driver:

user@ubuntu:~/tew-421pc$ cd Drivers/Windows\ XP/
user@ubuntu:~/tew-421pc/Drivers/Windows XP$  sudo ndiswrapper -i Mrv8000c.INF 

You should see output similar to this during the install:

installing mrv8000c ...

You should not receive any warnings or errors.

Return to your home directory using a bare cd command:

user@ubuntu:~/tew-421pc/Drivers/Windows XP$ cd

Using ndiswrapper we can list the installed driver to make sure that we have it:

user@ubuntu:~$  ndiswrapper -l
installed drivers:
mrv8000c                driver installed, hardware (11AB:1FAA) present 

If you device is plugged into the system you will see that the driver is installed and the hardware is present. If your device is not plugged in, then do so now and repeat this step to confirm hardware operation.

We can also look inside the directory where the drivers get stored by ndiswrapper:

user@ubuntu:~$  ls /etc/ndiswrapper

And the contents of the mrv8000c subdirectory are:

user@ubuntu:~$  ls /etc/ndiswrapper/mrv8000c
11AB:1FAA.5.conf  mrv8000c.inf  mrv8000c.sys

Bring up the driver:

user@ubuntu:~$  sudo depmod -a
user@ubuntu:~$  sudo modprobe ndiswrapper

If you do not get any errors and your system does not immediately freeze the driver should now be loaded. It may take a few seconds (12 - 30) for the modprobe to return, please wait. Do not reboot until we have made some basic checks and installed the driver permanently.

Step 6 - Install the device and configure the network settings

Issuing an iwconfig command should reveal that your device is waiting to be configured, similar to this one:

user@ubuntu:~$  iwconfig
lo        no wireless extensions.

eth0      no wireless extensions.

wlan0     IEEE 802.11b  ESSID:off/any  
          Mode:Managed  Frequency:2.412 GHz  Access Point: Not-Associated   
          Bit Rate:11 Mb/s   
          RTS thr:2432 B   Fragment thr:2432 B   
          Power Management:off
          Link Quality:95/100  Signal level:-35 dBm  Noise level:-96 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

You should be able to put your data in through the System-->Administration-->Networking applet. You just need to end up with the record formats that I am showing in my example. I used gedit to put the required record into the /etc/network/interfaces file: (note that the Xs are your actual WEP key.)

user@ubuntu:~$  gksudo gedit /etc/network/interfaces

Create a record that looks like this: (Note we are using 128bit WEP encryption in this example.)

iface wlan0 inet dhcp
wireless-essid My_Essid
auto wlan0

Save the file.

Make the driver permanent using the ndiswrapper method:

user@ubuntu:~$ sudo ndiswrapper -m
adding "alias wlan0 ndiswrapper" to /etc/modprobe.d/ndiswrapper ...
couldn't add module alias:  at /usr/sbin/ndiswrapper line 717.

Critical Notice: Check the file /etc/modprobe.d/ndiswrapper file and make sure that the ndiswrapper alias is wlan0 an not something else such as eth1.

Use cat to look at /etc/modprobe.d/ndiswrapper and ensure that it contains the line "alias wlan0 ndiswrapper" and nothing else:

user@ubuntu:~$ cat /etc/modprobe.d/ndiswrapper

Make sure that it contains only the wlan0 identifier and no other:

alias wlan0 ndiswrapper

If it contains anything else edit /etc/modprobe.d/ndiswrapper and ensure that it contains the line "alias wlan0 ndiswrapper" and nothing else:

user@ubuntu:~$ gksudo gedit /etc/modprobe.d/ndiswrapper

Save the file.

Reboot your system in preparation for testing and validation of your work.

Step 7 - Testing the device

Now when we run iwconfig we should see that your ESSID and Access Point fields have been filled in with your access point's correct information and the Frequency field shows the correctly detected frequency:

user@ubuntu:~$  iwconfig
lo        no wireless extensions.

eth0      no wireless extensions.

wlan0     IEEE 802.11b  ESSID:"My_Essid"  
          Mode:Managed  Frequency:2.412 GHz  Access Point: 00:08:74:02:01:FC   
          Bit Rate:11 Mb/s   
          RTS thr:2432 B   Fragment thr:2432 B   
          Power Management:off
          Link Quality:95/100  Signal level:-35 dBm  Noise level:-96 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

The ESSID field should contain the name of your wireless network and the Access Point field should be filled in with the MAC identifier of your access point.

Run a "netstat -rn" command, and you should see that the correct routing is setup:

user@ubuntu:~$ netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface   U         0 0          0 wlan0         UG        0 0          0 wlan0

In this case is the gateway address to an Internet router.

If everthing looks good then all of your network data has been entered correctly.

Step 8 - Controlling the device

My system does not restart this device on startup, so I use the ifup and ifdown commands to control it. Scanning is supported in iwlist so you can scan for networks and wifi-radar works as well.

You can now control the device with ifup and ifdown:

user@ubuntu:~$ sudo ifdown wlan0
user@ubuntu:~$ sudo ifup wlan0
user@ubuntu:~$ sudo iwlist wlan0 scanning

Removing and inserting the device should remove and setup the network correctly, at least it does with this device.

If you need to restore or change your system's route to the internet you can use dhclient:

user@ubuntu:~$ sudo dhclient wlan0

Hopefully, you have arrived at the end of this procedure with a working device. Refer questions to the Networking & Wireless section of the forums.


ndiswrapper team:

Pontus Fuchs - Main developer.

Giridhar Pemmasani - Main developer.

Various - Misc minor patches.

Necessary Changes or Questions

Please contact FrodoB through a private message or through the Networking & Wireless section of the forums if you see items that need to be clarified or improved upon. Thank you very much.

WifiDocs/Device/TRENDnet_TEW-421PC_H/W:B1_(ndiswrapper) (last edited 2008-06-27 10:15:11 by localhost)