O'Reilly logo

Ubuntu Hacks by Bill Childers, Kyle Rankin, Jonathan Oxer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Hack #41. Get Proprietary Wireless Cards Working

If your computer has a Wi-Fi card that's not Linux-friendly, don't fret. Ndiswrapper and ndisgtk will let you use that card under Ubuntu by encapsulating the native Windows driver.

In "Roam Wirelessly" [Hack #42], you'll see that Ubuntu ships with built-in drivers for a good deal of the wireless network cards on the market today, such as the Intel "ipw" line of miniPCI adapters and the Prism 2/3-based PCMCIA network adapters. If you happen to use a computer that's equipped with such hardware, Ubuntu's wireless networking will likely "just work" right out of the box. However, systems equipped with Broadcom-based Wi-Fi adapters and the like traditionally don't work with Ubuntu or other Linux distributions. The primary cause for this is usually that the manufacturer doesn't release specifications for their hardware, which keeps open source developers from writing drivers for it.

Recently, however, there's been a development that enables almost any Wi-Fi adapter to work in Linux. It's known as ndiswrapper, and it works by "wrapping" the manufacturer's own drivers with a Linux driver layer that the OS can utilize. It's not ideal, but for obscure and difficult wireless hardware, ndiswrapper is often the way to go.


If you're using Linux on a platform other than x86 (such as on a Mac), then ndiswrapper won't work for you because it uses drivers that are compiled for x86 CPUs. However, there is an open source driver available for some Broadcom chipsets, including the one used in Apple's AirPort Extreme (802.11g). You'll still need native drivers for your chipset, though, but only to extract the firmware needed to operate the card correctly. See http://bcm43xx.berlios.de/ for more information.

Installing ndiswrapper and ndisgtk

Start by installing the ndisgtk package, which is a GUI installation program for ndiswrapper. You can open a terminal window and install it from the command line or use your favorite package-management tool. Please ensure you have the universe repository enabled [Hack #60]. (Aptitude will automatically get ndiswrapper-utils, since it's a dependency for ndisgtk.) Also, make sure you have the Windows drivers for your particular wireless adapter ready, since ndisgtk will prompt you for them later on. If you find that the Windows drivers are trapped in a .cab file, try installing cabextract and unshield and using those to get at the precious drivers trapped within (both of these are available in the universe repository):

conner@firetruck:$ sudo aptitude install ndisgtk

Wrapping the Windows Drivers

Once that is done, insert or enable your wireless adapter and run ndisgtk from a terminal:

conner@firetruck:$ sudo ndisgtk

ndisgtk will present you with a window (see Figure 4-6), allowing you to install a new driver.

Ndisgtk's main window

Figure 4-6. Ndisgtk's main window

Click on "Install new driver," and ndisgtk will ask you for the location of your Windows drivers, as shown in Figure 4-7. Choose your Windows drivers in the Location field and click Install.

Where are your drivers?

Figure 4-7. Where are your drivers?

Once ndisgtk is finished copying your drivers and setting up the files, you will see the first window again, but ndisgtk will have populated it with your driver, as shown in Figure 4-8.

Windows-only hardware? I think not...

Figure 4-8. Windows-only hardware? I think not...

Configuring the Adapter

At this point, the wireless adapter is just another piece of Linux-enabled hardware. You can use the standard Ubuntu tools, such as the network wizard in the System menu or NetworkManager [Hack #42], to manage the connection. As a sanity check, you can run dmesg and see if ndiswrapper picked up your adapter:

conner@firetruck:$ dmesg
[4295357.170000] pccard: CardBus card inserted into slot 0
[4295357.181000] ndiswrapper: driver tnet1130 (Texas Instruments,06/17/2004, loaded
[4295357.182000] PCI: Enabling device 0000:02:00.0 (0000 -> 0002)
[4295357.182000] ACPI: PCI Interrupt 0000:02:00.0[A] -> Link [LNKD] -> GSI 11 (level, low) -> IRQ 11
[4295357.183000] PCI: Setting latency timer of device 0000:02:00.0 to 64
[4295357.876000] ndiswrapper (IoCreateUnprotectedSymbolicLink:744): --UNIMPLEMENTED--
[4295357.876000] ndiswrapper: using irq 11
[4295358.916000] wlan0: vendor: 'TNET1130'
[4295358.916000] wlan0: ndiswrapper ethernet device 00:12:0e:0d:3c:38 using driver tnet1130, 104C:9066:13D1:AB80.5.conf
[4295358.916000] wlan0: encryption modes supported: WEP; TKIP with WPA

Also, the standard iwconfig command-line tool can be used to configure your adapter, if you're comfortable with that:

conner@firetruck:~$ iwconfig wlan0
wlan0     IEEE 802.11g  ESSID:"NullDevice.Net" 
          Mode:Managed  Frequency:2.462 GHz Access Point: 00:0C:41:6E:98:8E
          Bit Rate:54 Mb/s   Tx-Power:10 dBm  Sensitivity=0/3
          RTS thr:4096 B   Fragment thr:4096 B
          Power Management:off
          Link Quality:100/100  Signal level:-42 dBm  Noise level:-256 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0


There is one flaw with ndiswrapper. Due to the way it operates, signal strength meters (such as those provided by NetworkManager [Hack #42] and the command-line iwconfig tool) do not work properly. Those tools will always report 100-percent signal strength.

Don't let the fear of incompatible wireless network cards keep you from using Ubuntu on your computer. Now you can free yourself and your operating system by using ndiswrapper on Ubuntu!

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required