Learning Old School Linux

Home > Other > Learning Old School Linux > Page 6
Learning Old School Linux Page 6

by Ed Hartnett

Wi-Fi and Linux

  I hate to admit it, but managing wireless networking is something that Windows and Mac OS sometimes are a little better at than Linux.

  It's not that Linux doesn't have the capability the network anywhere that Windows or Mac OS does, it's just a little bit harder, and a little less obvious what to do. The graphical users interfaces are not always as intuitive as the Windows ones (yet - remember that Linux is always improving.)

  The Graphical User Interface

  All Linux distributions these days have some sort of graphical user interface which handles network configuration. The Asus EEE system I use, which has a specialized version of the Xandros distribution, has a utility called "Network Connections." It gives a very nice GUI which shows the wireless networks I've configured, and allows me to edit the details of each.

  There's really nothing wrong with this GUI, except that there doesn't seem to be an easy way to get a list of all the available wireless networks. That is, if I am in an new environement, like a coffee shop, and I want to see if there are any wireless networks available, there seems to be no easy way to do that, except to start the wizard to create a new connection, and proceed through several windows of questions before getting the list of available networks.

  Thing is, I need the list of available networks first, and I don't get it.

  The Command Line to the Rescue

  In the very old Western movies - the ones that were old even when I was a boy - the movie would always end with the U.S. Cavalry coming over the hill, with the bugle sounding "Charge!" (https://www.15thnewyorkcavalry.org/Media/charge.wav.)

  That music plays in my head every time I am dissatisfied with a Linux GUI, and I open my bash shell to get a command line. I don't care what you are trying to do - in Linux, you can always do it from the command line. And in many cases the extra documentation and design of the command line tools help you gain a fundamental understanding of what is going on.

  Even better, while GUI will vary from desktop to desktop, and may also depend on other installed applications on a machine, the command line is always the same. It's like having 100 cavalry troopers gallop over the hill, with pistols blazing, swords drawn, banners flying, and bugles bravely telling all your problems to get the heck out of the way.

  When that happens, your problems suddenly don't seem so big after all. And that's what happens when you go to the Linux command line tools.

  The Wireless Trooper: iwlist

  The command to start with is iwlist. The iwlist command lists all the wireless networks that your wireless card can find. It gives me an output like this:

  yumyum:/home/user> iwlist ath0 scanning

  ath0 Scan completed :

  Cell 01 - Address: 00:1B:11:58:1F:B5

  ESSID:"michelle"

  Mode:Master

  Frequency:2.412 GHz (Channel 1)

  Quality=18/94 Signal level=-77 dBm Noise level=-95 dBm

  Encryption key:off

  Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s

  9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s

  48 Mb/s; 54 Mb/s

  Extra:bcn_int=100

  Extra:wme_ie=dd070050f202000100

  Cell 02 - Address: 00:1B:FC:CE:DC:35

  ESSID:"Thunder Lake"

  Mode:Master

  Frequency:2.437 GHz (Channel 6)

  Quality=17/94 Signal level=-78 dBm Noise level=-95 dBm

  Encryption key:on

  Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 18 Mb/s

  24 Mb/s; 36 Mb/s; 54 Mb/s; 6 Mb/s; 9 Mb/s

  12 Mb/s; 48 Mb/s

  Extra:bcn_int=100

  Cell 03 - Address: 00:1B:2F:E0:12:14

  ESSID:"NETGEAR"

  Mode:Master

  Frequency:2.437 GHz (Channel 6)

  Quality=6/94 Signal level=-89 dBm Noise level=-95 dBm

  Encryption key:on

  Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s

  12 Mb/s; 24 Mb/s; 36 Mb/s; 9 Mb/s; 18 Mb/s

  48 Mb/s; 54 Mb/s

  Extra:bcn_int=100

  Extra:ath_ie=dd0900037f0101001dff7f

  Cell 04 - Address: 00:0F:B3:5B:08:39

  ESSID:"ACTIONTEC"

  Mode:Master

  Frequency:2.452 GHz (Channel 9)

  Quality=38/94 Signal level=-57 dBm Noise level=-95 dBm

  Encryption key:on

  Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 22 Mb/s

  6 Mb/s; 9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s

  36 Mb/s; 48 Mb/s; 54 Mb/s

  Extra:bcn_int=200

  The thing to look for here is the name of the node (or the ESSID, as it's known in computerese), and the encryption key. For my home network (ACTIONTEC), the encryption is on, as it should be, and the wireless card must be configured with the proper key before it will work.

  Meanwhile, my neighbor Michelle has an unencrypted node. This is bad in a home network, but usual for free wireless networks, like those in coffee shops.

  (Note that the iwlist command is located in the /sbin directory in my distribution (as is the iwconfig command discussed below). That's not in my path unless I log in as root, and on some machines, it's not in root's path either until you explicitly add /sbin to the PATH.)

  With the iwlist command I can find out what networks are available. Once I know, what do I do next?

  The iwconfig Command

  In the cavalry of Linux system administration tools, iwconfig is the trooper to help out with wireless networking configuration.

  There are several important settings with wireless networking: the network name (called ESSID), the frequency, the mode, and the access point, as well as some other parameters that are less frequently used. The iwconfig command lets you set them all. When run without any command line options the iwconfig command will show current settings. By using the command line options, you can change parameters and configure for any wireless network.

  The most common way to use the iwconfig command would be to set the name of a network. For example, if you are in a coffee shop with a free, unencrypted, wireless network called "coffeeshop", you can configure wireless like this:

  iwconfig ath0 essid coffeeshop

  iwconfig ath0 key off

  iwconfig ath0 ap any

  The Ups and Downs of Networking

  Once you've got your wireless configured, use the ifup and the ifdown commands to bring the interface up and down.

  In most cases, I use the command line to gain a better understanding of what is going on in the system. Often, with the increased knowledge gained at the command line level, I can go back to the GUI and quickly sort through the jumble of menus and buttons to find what I need.

  Getting More Information

  The trusty man command, like the knowing cavalry sergeant, can tell you everything you need to know. Just type "man iwconfig." I often open a separate bash window for man commands, so that I can leave the documentation open on my screen while I compose my command in a different bash window. If you are operating without any GUI at all, the same can be achieved with the screen command, or by using an editor like emacs.

  Now that you have a better understanding of command line handling of wireless networking, perhaps
you'll one day call in the cavalry!

 

‹ Prev