P. 1
Wireless Manual

Wireless Manual

|Views: 0|Likes:
Published by dhyablo

More info:

Published by: dhyablo on Feb 14, 2012
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less





Using wireless-tools to connect to wireless internet from the command line

by RogueClown adalia@weaknetlabs.com

at least with respect to networking capabilities. and you will not be able to configure your wireless connection. your computer will not recognize the commands. Maybe you are just curious. If you do not have root privileges or wireless networking superuser privileges. Make sure that you have these privileges. Maybe the graphical interface on the computer you're using has become corrupted or somehow unusable. The hardest thing about it is finding all of the information you need in one place. note that almost all of the necessary commands require root or superuser privileges. and you need to get on the internet to figure out how to troubleshoot the problem. Otherwise. Whatever your reasons for needing to control your wireless connection from the command line. or install as few graphical programs as possible. in a form that doesn't assume that you already know how to do it. the good news is that doing it is very easy. and requires learning only a few simple commands. consult your system administrator. Maybe you will be on a computer that does not have a graphical interface installed for the wireless connection. Before we begin.ABSTRACT Sooner or later. Maybe you have an computer with so few system resources that you'd like to avoid installing a GUI at all. it is going to happen. .

and your computer is currently connected to the internet. download the suite at: http://www. you can check to see if you have the most current version of wireless-tools by opening up a terminal and typing the command: dpkg -l | grep wireless-tools This command looks at the list of all of the packages installed on your computer. To find the name of your wireless card. don't be discouraged if it looks a little different. looking something like this: ii wireless-tools Wireless Extens 29-1ubuntu2 Tools for manipulating Linux This is from an HP Pavilion laptop running Ubuntu 8. this is your 1 Debian-based distributions include some popular ones like Ubuntu. However. if it is not. which explain how to install and compile the software. check your distribution's documentation to verify how to check for an installed program. and your computer does not have wireless-tools installed.html#latest Read the included instructions. Knoppix. and lets it search for wireless-tools. and you can skip to the next section and start learning how to use it. If it does exist on your computer. type the following command into your command line: ~$ sudo lshw -C network lshw produces the list of hardware connected to your computer. Odds are that it is installed already on your system. and turn it on. it returns a line of text containing it. If your distribution does not have an automated package manager. a quick Google search for your distribution should tell you which core it is based on. pipes the list into grep. Finding and turning on your wireless card Before scanning for a wireless network.hpl. Find the entry that says description: Wireless interface. install it by typing: sudo apt-get install wireless-tools If you are not using a Debian-based distribution.04. and to verify whether your distribution has an automated package management system through which you can install wireless-tools. However. this list is by no means exhaustive. If you are using a Debian-based distribution1. . What matters is off to the left of the line of text: that it says that wireless-tools is installed on your machine. a suite of programs that comes with most Linux distributions. and -C network filters the list to show only network devices.hp.com/personal/Jean_Tourrilhes/Linux/Tools.Making sure you have wireless-tools installed This tutorial covers basic wireless connection management using wireless-tools. you need to find the name of your wireless card. Xandros. and Damn Small Linux.

The block of information with that ESSID is going to have everything you need to know--in fact. both wired and wireless. If you're in a familiar location like home or your favourite coffee shop. Scanning for a wireless network wireless-tools has a useful utility called iwlist. and find the one with the ESSID matching the wireless network to which you normally connect. Look through the entries returned by iwlist." wireless-tools gives you that same identifier. before you start connecting to a new wireless network. you need to make sure that your wireless interface is on and not still trying to connect to an old network from somewhere else. Now you're ready to scan for a network. If you're in an unfamiliar location. that means it has a WEP [Wireless Encryption Protocol] key. ifconfig allows you to configure network interfaces. and note the logical name of your wireless interface. Piping it into less makes it a lot easier to scroll through. That name is called the "ESSID. According to the man page [accessible by typing man iwlist]. look at the "Encryption key" field. then finding the wireless network is easy. Now. a password to get on the network. If it says “on”. a protocol discussed in a little more detail later in this article. Look down several lines. and the network associated with the location has a password. its scan mode reveals wireless networks that your card detects. a whole lot more than you need to know--for connecting to the wireless network. type the following series of commands: ~$ sudo ifconfig [interface] down ~$ sudo dhclient -r [interface] ~$ sudo ifconfig [interface] up This series of commands uses two command-line network configuration programs: ifconfig and dhclient. then you can do the same thing from the iwlist results that you . The last command uses ifconfig again. The second command uses dhclient to release [-r] your wireless card from any IP address it had been bound to before. you can just use your up and down arrows. dhclient is a command-line program that manages connections to networks that use dynamic host configuration. it shows the name of the system. If you're at a coffee house or another public place with WiFi. First of all. To accomplish this. the first command uses this program to turn your wireless card off. don't despair. iwlist gives you plenty of information with which to select a wireless network.wireless card. this time to bring your wireless interface back up. If you cannot get the password for any of the stray wireless networks around. Knowing the name of your wireless interface is important. Even when you use a graphical program to connect to wireless. because usually the list is too long to fit on one screen. Make sure to pipe the iwlist scan into less. it shows wireless networking information that is not accessible from iwconfig. ask the staff for it. it will either say on or off. What does this mean to you? Pertinent to getting your wireless working from the command line. Type the following into your command line: ~$ sudo iwlist [interface] scan | less and you will get a list of the wireless networks available. because you need it to tell your computer which piece of hardware to configure and connect with.

the systems administrator comes up with a phrase that the router converts into a hexadecimal code. In many cases. and type the following onto your command line: ~$ sudo iwconfig [interface name] mode managed key [password. are case sensitive. do not put single-word ESSIDs in quotes. yet another part of the wireless-tools suite. especially if you're new to doing command-line wireless configuration. This is good news for you. with the encryption key cf1e94a35b. which can be difficult to memorize. you must put it in quotes. since not only is it a little more secure than static IP addressing. I always had to write that information down. Take the information that you gathered during your scan. The mode managed section of the command tells your wireless card that it is supposed to associate with a central access point that is offering wireless network services. you would type the following: ~$ sudo iwconfig eth1 mode managed key off essid Homenet Know also that if the ESSID has more than one word. when it attempts to connect.can from a graphical interface: look for unsecured networks. as shown above. it will start giving that key to the wireless network that doesn't need one—and you will not get on the wireless network. instead of trying to connect directly with other computers in a network. the network assigns a computer its identifying details. To use interface eth1 to connect to a network called allienet. It is important to remember to always give a key instruction to iwconfig. you can use iwconfig with that passphrase by prefacing the passphrase with s:. including its IP address. with the passphrase lolrushas2bukkits@home. even if there is no key needed to get onto the wireless system. See which networks have "Encryption key:off". or 'off' if no password] essid [E S SID] This command uses the program iwconfig. if you want to use interface ath0 to connect to a network called Robust Beans Coffee. some systems instead give out an ASCII passphrase. However. Until I had memorized the syntax of the commands and the information for my favourite wireless networks. Instead of memorizing the key. Instead of assigning a computer the same IP address to use for all time [as is true when a network uses a static protocol]. look for the one with the highest Quality [another field on iwlist]. if you wanted to use a wireless interface called eth1 to connect to a network called Homenet that doesn't use an encryption key. be they single-word or multiword. Thus. the network key. Otherwise. Don't be shy about jotting down your interface name and ESSID. Configuring your connection to the wireless network Most home and public wireless networks use a protocol called DHCP: Dynamic Host Configuration Protocol. So. to configure your wireless card to be ready to connect to the wireless network of your choice. it makes connecting to the network easier. you would type the following: ~$ sudo iwconfig eth1 mode managed key s:lolrushas2bukkits@home essid . All ESSIDs. if there was already a key configured for the wireless card's use. you would type the following: ~$ sudo iwconfig ath0 mode managed key cf1e94a35b essid “Robust Beans Coffee” Instead of directly giving a key. and among those.

233. It's fairly intuitive which programs do what. To do that. start from the beginning and try again. connected to the network yet. But. If you have any questions about the content of this paper. Go back and make sure that you typed all of the commands correctly. and assigned all of the commands that needed [interface] fields to the correct name of your wireless interface. . attempt to connect to it. especially if you are unaccustomed to using the command line.com (64. the syntax will come. and it's a useful skill to have in case you need a wireless internet connection from a Linux computer without a graphical wireless program. It will ask the access point to assign your computer an IP address. please e-mail me at adalia@weaknetlabs. go ahead and ping a website you know will be up: ~$ ping www. and the network binds your computer to an IP address. contact the systems administrator.D. is your IP address on the network. If you typed any of the commands incorrectly. however. and instead returns an error.allienet After typing this configuration command.B. then it could be a problem with the network.com. Hit ctrl-C to stop the pinging. you have told your wireless card what it needs to know in order to find the network and ask it for a connection.D] A. you need to get your wireless card to ask the network for a connection. If you typed all of the commands in correctly. and enjoy using the internet. If you do not. Conclusion Connecting to wireless from the command line using the wireless-tools suite may seem a little complicated at first.167. you are not connected to the internet.B. Type: ~$ sudo dhclient [interface] This command should connect you to the wireless network. You are not. To make sure your connection works. If your dhclient command makes multiple attempts to connect does not return the bound to message.147): icmp_seq=5 ttl=242 time=60.C. after a few times going through this process. If it's successful. it will say on the screen: bound to [A.google. it will be four numbers separated by periods.C.google. If you have access to any of the other networks shown on iwlist.com If the ping starts returning lines like this: 64 bytes from py-in-f147.9 ms Congratulations! You're on the internet.

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->