Configure a Wireless Network Interface


iwconfig

In the previous section, "View the Status of Your Wireless Network Interfaces," you used iwconfig to see important details about your wireless card and its connection. You can also use iwconfig, however, to configure that wireless card and its connections. If this sounds like ifconfig, it should, as iwconfig was based on ifconfig and its behaviors.

Note

You can make several changes with iwconfig, but you're only going to look at a few (for more details, see man iwconfig).


The network topologies associated with wired networks, such as star, bus, and ring, to name a few, have been known and understood for quite some time. Wireless networks introduce some new topologies to the mix, including the following:

  • Managed (an access point creates a network to which wireless devices can connect; the most common topology for wireless networking)

  • Ad-Hoc (two or more wireless devices form a network to work with each other)

  • Master (the wireless device acts as an access point)

  • Repeater (the wireless device forwards packets to other wireless devices)

There are others, but those are the main ones. Using iwconfig, you can tell your wireless card that you want it to operate differently, in accordance with a new topology.

Tip

For more on stars, busses, rings, and the like, see Wikipedia's "Network Topology" at http://en.wikipedia.org/wiki/Network_topology.


# iwconfig ath0 mode ad-hoc 


After specifying the interface, simply use the mode option following the name of the mode you want to use.

Note

Remember that the card you're using in these examples has an interface name of ath0; yours might be etH1, wlan0, or something else entirely. To find out your interface's name, use iwconfig by itself, as discussed in the previous section.


The Extended Service Set Identifier (ESSID) is the name of the wireless network to which you're joined or you want to join. Most of the time an ESSID name of any will work just fine, assuming that you can meet the network's other needs, such as encryption, if that's necessary. Some networks, however, require that you specify the exact ESSID.

# iwconfig ath0 essid lincoln 


Here you are joining a wireless network with an ESSID of lincoln. Simply use the essid option, followed by the name of the ESSID, and you're good.

More and more networks are using encryption to protect users' communications from sniffers that capture all the traffic and then look through it for useful information. The simplest form of network encryption for wireless networks is Wired Equivalent Privacy (WEP). Although this provides a small measure of security, it's just that: small. WEP is easily cracked by a knowledgeable attacker, and it has now been superseded by the much more robust Wi-Fi Protected Access (WPA). Unfortunately, getting WPA to work with wireless cards on Linux can be a real bear, and is beyond the scope of this book. Besides, WEP, despite its flaws, is still far more common, and it is better than nothing. Just don't expect complete and total security using it.

Tip

For more on WEP and WPA, see Wikipedia's "Wired Equivalent Privacy" (http://en.wikipedia.org/wiki/WEP) and "Wi-Fi Protected Access" (http://en.wikipedia.org/wiki/Wi-Fi_Protected_Access). You can find information about getting WPA to work with your Linux distribution at "Linux WPA/WPA2/IEEE 802.1X Supplicant" (http://hostap.epitest.fi/wpa_supplicant). If you're using Windows drivers via ndiswrapper, also be sure to check out "How to Use WPA with ndiswrapper" (http://ndiswrapper.sourceforge.net/mediawiki/index.php/WPA).


WEP works with a shared encryption key, a password that exists on both the wireless access point and your machine. The password can come in two forms: hex digits or plain text. It doesn't really matter which because iwconfig can handle both. If you've been given hex digits, simply follow the enc option with the key.

# iwconfig ath0 enc 646c64586278742a6229742f4c 


If you've instead been given plain text to use, you still use the enc option, but you must preface the key with s: to indicate that what follows is a text string.

# iwconfig ath0 enc s:dldXbxt*b)t/L 


Tip

I created those WEP keys using the very nice WEP Key Generator found at www.andrewscompanies.com/tools/wep.asp.


If you have several options to change at one time, you probably would like to perform all of them with one command. To do so, follow iwconfig with your device name, and then place any changes you want to make one after the other.

# iwconfig ath0 essid lincoln enc  646c64586278742a6229742f4c 


The preceding listing changes the ESSID and sets WEP encryption using hex digits for the wireless device ath0. You can set as many things at one time as you'd like.



Linux Phrasebook
Linux Phrasebook
ISBN: 0672328380
EAN: 2147483647
Year: 2007
Pages: 288

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net