The Broadcom Wireless Card Guide

Introduction: Unfortunately, most Broadcom wireless cards need proprietary firmware to get connected; many major distributions make it easy to get this firmware, but the tools they bundle need an Internet connection to get it, which is not always possible. Most tutorials currently online also assume you have a working Internet connection already, but this one will give you instructions on how to install the drivers manually. Don’t worry, it’s not that hard. :D

Step 1: find out what card you have.
There are lots of Broadcom cards out there. To find out what yours is, open a terminal and type or copy-paste (use right-click > Paste to paste into terminals) the following for Ubuntu and Debian:
sudo lspci -vnn | grep 14e4
Or the following for Fedora and others:
su -c "lspci -vnn | grep 14e4
The result should be something like this:
02:00.0 Network controller [0280]: Broadcom Corporation BCM4312 802.11b/g LP-PHY [14e4:4315] (rev 01)
From this, you need the PCI ID, which has been italicized in the sample above. Now look up your PCI ID in the following table:

PCI ID Chip Driver(s) Notes
14e4:4301 BCM4303 b43legacy
14e4:4306 BCM4306 rev. 2 b43legacy Two IDs, same card (?)
14e4:4320
14e4:4307 BCM4306 rev. 3 b43
14e4:4311 BCM4311 b43, wl
14e4:4312 BCM4312 b43 Unsure about this one
14e4:4313 BCM4313 b43, wl Unsure about this one
14e4:4315 BCM4312 b43, wl Requires LP/PHY firmware
14e4:4318 BCM4318 b43
14e4:4328 BCM4321 wl Two IDs, same card (?)
14e4:4329
14e4:432b BCM4322 wl
14e4:4353 BCM43224 wl
14e4:4357 BCM43225 wl

Okay, that table above might confuse you, so let me explain. On the first column you get the PCI ID of the card, which you should already know. On the second column, you get the actual chip’s name. These are not the same as Product IDs (the part of the PCI ID after 14e4:); you can probably use those to verify that you have the right card. On the third column you have the drivers that support each card. You will need to pick one of them and install it; details lie below. And on the fourth column you have any notes related to the card.
If your card isn’t listed there, it probably doesn’t work. I recommend you check this page for more details, but watch out for conflicting information!

Step 2: Pick the right driver.
There are two major drivers for the current series of Broadcom cards, plus one for older cards and one in development (not mentioned here).

  1. Broadcom STA (also known as wl) is the official, Broadcom driver for a few cards typically found in Dell and HP laptops. It’s theoretically more stable than b43 and doesn’t need additional firmware, but it lacks some advanced features and is proprietary software.
  2. b43 is a free-as-in-freedom unofficial driver that requires, however, proprietary firmware to work. It offers a lot more features than wl and, in my experience, is also a lot faster. It can have some issues with new cards, but it should generally work.
  3. b43-legacy is a driver for older BCM43xx cards that don’t work with b43; it’s also free-as-in-freedom, but requires proprietary firmware.

Using this information and the table above, pick one of the drivers and skip to the relevant section…

Installing the Broadcom STA (wl) driver
Ubuntu: you’ll need to download the following packages (choose your Ubuntu release, architecture and mirror): dkms, patch, fakeroot and bcmwl-kernel-source.
After you’ve downloaded the .deb files, use a USB flashdrive or some other means of file transfer to get them on the computer you want to install to. Then, just double-clicking each file should bring up Ubuntu Software Center and let you install it.
Then just navigate to System > Administration > Additional Drivers (or Hardware Drivers for older releases) and activate the Broadcom STA driver.
Check out this page for more information about online installation, but please note that the offline installation instructions are pretty much outdated for wl.
Important note: if this fails, use Keryx (0.92, not 1.0) to do an offline upgrade and install the bcmwl-kernel-source package. An up-to-date Keryx tutorial is on my to-do list.
Other distributions: you can compile the STA driver yourself. 32-bit .tar.gz, 64-bit .tar.gz, readme. The readme explains how to compile the drivers pretty well, so I’m not going to do that here.

Installing the b43 driver (non-LP/PHY cards)
If your card’s PCI ID is 14e4:4315 (BCM4312 chip), you should use the instructions a little further down, since it’s a LP/PHY card.
Get b43-fwcutter: for Ubuntu, download and install b43-fwcutter (pick your version and architecture; direct link for the impatient). I believe it’s installed by default with openSUSE and Fedora, and possibly others. If your distribution doesn’t have it, download the tarball and compile it using the following commands (I recommend you only do this if you have some experience with the Linux shell):
tar xjf b43-fwcutter-013.tar.bz2
cd b43-fwcutter-013
make
cd ..

Unload the module: run this command: sudo modprobe -rv b43 ssb (or su -c "modprobe -rv b43 ssb" if you don’t have sudo installed or usable).
Get the firmware: you’ll need to download this package. Then open a Terminal, cd to where you downloaded it and run the following commands (substitute b43-fwcutter with the actual path to the b43-fwcutter executable if you compiled it yourself):
tar xjf broadcom-wl-4.150.10.5.tar.bz2
cd broadcom-wl-4.150.10.5/driver
sudo b43-fwcutter -w /lib/firmware wl_apsta_mimo.o

If you don’t have sudo installed or usable (just su), use this command instead:
su -c "b43-fwcutter -w /lib/firmware wl_apsta_mimo.o"
Finish up: I suggest you restart. You can probably get around with using sudo modprobe -v b43 on some distros (I usually do that on Ubuntu), but please, please, don’t ever run that command on openSUSE, you’ll just completely mess your system up and yell at me. On second thought, please just restart after installing.

Installing the b43 driver with LP/PHY firmware
This seems to only be relevant for BCM4312, which happens to be the card I have. First, you’ll need b43-fwcutter, which you can get using the instructions above. Then, get the correct firmware package and use these commands to install it:
sudo modprobe -rv b43 ssb
tar xjf broadcom-wl-4.178.10.4.tar.bz2
cd broadcom-wl-4.178.10.4/linux
sudo b43-fwcutter -w /lib/firmware wl_apsta.o

As usual, change sudo to su -c and put the rest in quotes if you don’t have sudo.
To finish up, restart your system.

Installing the b43legacy driver
Again, get b43-fwcutter as described above, then download this package and use the following command to install it:
sudo ./b43-fwcutter-013/b43-fwcutter -w /lib/firmware wl_apsta-3.130.20.0.o
I don’t own any b43legacy-compatible card, so I’m not sure whether you need to unload the b43legacy module (using sudo modprobe -rv b43legacy before you install the firmware. I’d say you should do it, just to be sure, then restart after installing the firmware.

Netcat, nc command

Netcat – also known as nc is considered the Swiss army knife of system administrators. In its most basic usage, netcat acts as a simple utility which reads and writes data across network connections, using TCP or UDP transport protocols. But this simple tool finds diverse uses for system administrators (Unix & Linux alike). Hence the name Swiss army knife.

Here is a tiny list of the things Netcat can accomplish –

  • Simultaneously act as a server at one end and a client at the other to seamlessly transfer files between remote machines.
  • Scan for open ports on the host machine or on a remote machine.
  • Setting up a chat server
  • Act as a web proxy

… just to name a few.

You will be amused to know that a few people have even broadcast the World Cup Soccer live in Ascii characters, which you can view using netcat command.

If you are looking for more uses of netcat, then you should check out the examples listed on the netcat Wikipedia page.

Netcat is available for Unix, Linux, Mac OS X, and Windows platform.

Iptstate, Pktstat – Network stats

iptstate-2.0-lookup-ss

Today I’ll show you two tools to be used int the terminal to monitor your network and the active connections: iptstate and pkstat

IPTState

IPTState is a top-like interface to your netfilter connection-tracking table.

Using iptstate you interactively watch where traffic crossing your netfilter/iptables firewall is going, sort by various criteria, limit the view by various criteria. But it doesn’t stop there: as of version 2.2.0 you can even delete states from the table!

The only requirements are a curses library (usually ncurses), and libnetfilter_conntrack version 0.0.50 or later.

iptstate displays information held in the IP Tables state table in real-time in a top-like format. Output can be sorted by any

field, or any field reversed. Users can choose to have the output only print once and exit, rather than the top-like system.

Refresh rate is configurable, IPs can be resolved to names, output can be formatted, the display can be filtered, and color coding

are among some of the many features.

IPTState is available in the Debian, Redhat, Fedora, Mandrake, Gentoo, FloppyFW, and many other distributions.

So on Ubuntu to install it just type in your terminal:

sudo aptitude install iptstate

Basic usage

From the terminal write iptstate [options] (you must be root, or use sudo)

Where the options can be:

-c, --no-color -  Toggle color-code by protocol
-C, --counters  - Toggle display of bytes/packets counters
-d, --dst-filter IP-  Only  show  states with a destination of IP Note, that this must be an IP, hostname matching is not yet supported.
-D --dstpt-filter port -  Only show states with a destination port of port
-h, --help - Show help message
-l, --lookup - Show hostnames instead of IP addresses
-L, --no-dns - Skip outgoing DNS lookup states
-f, --no-loopback - Filter states on loopback
-r, --reverse - Reverse sort order
-R, --rate seconds - Refresh rate, followed by rate in seconds. Note that this is for statetop  mode,  and  not   applicable   for   single-run   mode (--single).
-1, --single - Single run (no curses)
-b, --sort column - This determines what column to sort by. Options:
<ul>
	<li>S Source Port</li>
	<li>d Destination IP (or Name)</li>
	<li>D Destination Port</li>
	<li>p Protocol</li>
	<li>s State</li>
	<li>t TTL</li>
	<li>b Bytes</li>
	<li>P Packets</li>
</ul>
-s, --src-filter IP - Only show states with a source of IP. Note, that this must be an IP, hostname matching is not yet supported.
-S, --srcpt-filter port - Only show states with a source port of port

pktstat

pktstat_1

pktstat displays a real-time list of active connections seen on a network interface, and how much bandwidth is being used. Partially decodes HTTP and FTP protocols to show what filename is being transferred. X11 application names are also shown.

pktstat is available in Debian and Ubuntu. So on Ubuntu to install it just type in your terminal:

sudo aptitude install pktstat

To run pktstat, use the following command (you must be root, or use sudo):

pktstat -i eth0

Substitute eth0 with the ethernet card you want to watch, for me for example my wireless connection is on eth1.

Some of the options of pktstat are:

-B Display data rates in bytes per second (Bps) instead of in bits per second (bps).
-F Show full hostnames. Normally, hostnames are truncated to the first component of their domain name before display.
-i interface Listen on the given interface. If not specified, a suitable interface is chosen.
-n Do not try and resolve hostnames or service port numbers.
-p Show packet counts instead of bit counts.
-P Do not try to put the interface into promiscuous mode.
-t "Top" mode. Sorts the display by bit count (or packet count if -p was given) instead of by the name.
-T Show bit (byte) totals for flows.
-w waittime Refresh the display every waittime seconds. The default is 5 seconds.

Set up OpenDNS on Ubuntu

One sure-fire way to speed up your Internet connection is to replace your ISP’s slow DNS server with a third party DNS resolver like OpenDNS. Considered by many as one of the best DNS resolution services, OpenDNS is free and is really very easy to set up.

If you want further explanation about OpenDNS or if you are still not convinced to use it, perhaps you should go HERE first.

If you are ready to set up OpenDNS on your Ubuntu desktop, just follow these simple instructions:

1. Right-click on ‘Network Icon’ (located at top-right panel by default) and click on ‘Edit Connections’ to open Network Connections Manager.


2. Choose the type of connection you have. For this example, we will use ‘Wired’.

3. Under ‘Wired’, highlight ‘Auto etho’ and click on ‘Edit’.


4. Inside ‘Editing Auto etho’ window, click on ‘IPv4 Settings’ tab.

5. Under ‘IPv4 Settings’, change the ‘Method’ to Automatic (DHCP) addresses only.


6. Put these nameserver addresses as your ‘DNS Servers’: 208.67.222.222, 208.67.220.220

7. Click ‘OK’ and you are done setting OpenDNS on Ubuntu.

Set up Google Public DNS on Ubuntu

Google has recently released their very own DNS resolver with main goals of making web browsing faster and safer. Since Google’s search engine already crawls the web on a daily basis and in the process resolves and caches DNS information, they wanted to make use of their technology to experiment with new ways of addressing some of the existing DNS challenges around performance and security.

As I’ve said on my older post about OpenDNS, that replacing your ISP’s slow DNS server with a third party DNS resolution service will help speed up your Internet connection. So if you are already using OpenDNS right now and are pleased with it, why not try Google Public DNS.

Setting up Google Public DNS on Ubuntu is quick and straightforward.

Then, input these nameserver addresses as your ‘DNS Servers’: 8.8.8.8, 8.8.4.4.

Click “Ok” and you are done.

For advanced users, you can set up Google Public DNS by editing /etc/resolv.conf:

$ sudo gedit /etc/resolv.conf

Find and replace the nameserver lines with, or add, the following lines:

nameserver 8.8.8.8
nameserver 8.8.4.4

Save, and then exit. Restart your internet connection and test your new settings.

Vnstat – Network Traffic Monitoring Tool

vnstat is another app that can be used to monitor bandwidth usage. It is a little simpler and easier to use then the ipac-ng package. One of the benefits of vnstat is it’s not a running daemon so it takes up no memory. The process is created via a cron job which is run every 5 minutes.

Install

The vnstat package is very easy to install from the repositories with no dependencies.

sudo apt-get install vnstat

Setup

vnstat is meant to be used by any user so it needs to be set up that way first by giving correct permission. The following gives any user permission to use this feature. If desired you can set up a group so only users in the group can use this.

sudo chmod o+x /usr/bin/vnstat

sudo chmod o+wx /var/lib/vnstat/

Now vnstat should be ready to run

Usage

To create the cron job simply run this command

vnstat -u -i ath0

Replace ath0 with the interface you want to monitor

This creates a file in /var/lib/vnstat/ that collects the data for that interface. A cron job will run every 5 minutes to update the data. Below is a sample output with no options.

Database updated: Thu Jan 12 22:20:01 2006

        ath0

           received:           0.11 MB (nan%)
        transmitted:           0.01 MB (nan%)
              total:           0.12 MB

                        rx     |     tx     |  total
        -----------------------+------------+-----------
            today      0.11 MB |    0.01 MB |    0.12 MB
        -----------------------+------------+-----------
        estimated         0 MB |       0 MB |       0 MB

You can read more about options you can use to modify the output in the man page of vnstat.

Traffic Monitoring with vnStat

Interested in how much bandwidth you are using? vnStat is a simple command line utility to track network traffic on a Linux computer. vnStat is easy to set up and use on Ubuntu, and works well on both server and desktop systems.

Run these three commands to install vnStat and set up permissions so every user can run it:

sudo apt-get install vnstat
sudo chmod o+x /usr/bin/vnstat
sudo chmod o+wx /var/lib/vnstat/

You need to find the name of the network interface you want to monitor. Most of the time it will be called eth0, run

ifconfig

to check if you are not sure. Then run this command, replacing eth0 with the name of your network interface:

vnstat -u -i eth0

That command creates a cron job (scheduled task) that will run every few minutes and collect traffic data for vnStat.

Check the collected data by running vnstat on a command line. It will bring up the daily usage information:

Database updated: Thu Aug 30 13:40:01 2007

        eth0

           received:          90.65 MB (11.9%)
        transmitted:         666.12 MB (88.1%)
              total:         756.77 MB

                        rx     |     tx     |  total
        -----------------------+------------+-----------
        yesterday     49.94 MB |  378.44 MB |  428.38 MB
            today     17.27 MB |  125.30 MB |  142.57 MB
        -----------------------+------------+-----------
        estimated        29 MB |     218 MB |     247 MB

Run vnstat -h to see an hourly graph:

 eth0                                                                     13:40
  ^   t
  |   t
  |   t
  |   t
  |   t           t                                                     t
  |   t  t  t     t        t                                t  t     t  t
  |   t  t  t  t  t  t  t  t  t  t                 t  t     t  t     t  t
  |   t  t  t  t  t  t  t  t  t  t  t        t  t  t  t  t  t  t  t  t  t  t
  |   t  t  t  t  t  t  t  t  t  t  t  t  t  t  t  t  t  t  t  t  t  t  t  t
  |  rt  t  t  t  t  t  t  t  t  t  t  t  t  t  t  t  t  t  t  t  t  t  t  t
 -+--------------------------------------------------------------------------->
  |  14 15 16 17 18 19 20 21 22 23 00 01 02 03 04 05 06 07 08 09 10 11 12 13    

 h   rx (kB)    tx (kB)      h   rx (kB)    tx (kB)      h   rx (kB)    tx (kB)
14       2543      21517    22       1286       9950    06       1304       9431
15       1628      11561    23       1406       9223    07       1147       8576
16       1770      12431    00        999       7849    08       1775      12656
17       1388       9518    01        673       5071    09       1485      11738
18       1870      13693    02        932       6089    10       1063       7514
19       1392       9417    03        882       7620    11       1530      11656
20       1522      10194    04       1024       7629    12       2118      14688
21       1838      11744    05       1429       9662    13       1330       8130

vnStat has many more options as well. Run

vnstat –help

to more ways to look at the data. Also check out the screenshots section of the vnStat website for examples.
Start and test vnstat:
Note which interfaces are active on your PC.

vnstat -u -i eth0
vnstat -u -i eth1

Now you can generate text reports of your monthly bandwidth usage. I use eth1 in the following examples, but you may be using eth0 or both eth0 and eth1.
Daily bandwidth report.

vnstat -i eth1 -d

Hourly bandwidth report.

vnstat -i eth1 -h

Monthly bandwidth report.

vnstat -i eth1 -m

Real time speed report.

vnstat -i eth1 -l