Connecting to a wireless network from command-line
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Connecting to a wireless network from command-line
I run Ubuntu, and it has a nice GUI widget thing that connects me to my home wireless network when I boot. I don't have a problem with that. But suppose I don't start X, and boot to a recovery console for some reason, like I did recently when my graphics were broken after installing Karmic. In that case, my computer won't be connected to the wireless network until I log into X normally. So I can't apt-get anything or anything. It's very annoying. And I don't know how to connect to my wireless network.
I know my wireless network SSID, and I know my WEP key or WPA passphrase. How can I log onto the network with commandline tools? Is there some basic program that I can just run "networkmanager <myssid> <mywepkey>"? I looked at the iwconfig man page and I honestly couldn't figure out how to simply connect to my network.
Once I figure out how to connect to the network with command-line tools, where can I put an "autoconnect" script so that it will connect during startup, like it should anyway?
What I don't understand is, why the Ubuntu network manager nm-applet, doesn't just work as a front-end for more basic networking stuff. I don't see any reason why it should require you to start X before working; it could be a daemon that runs at startup, and there could be a config-file somewhere, but it doesn't even start running until I log onto gnome.
/sbin/iwconfig wlan0 ap 00:00:00:00:00:00 <<-Your ap
You know I have never had to do this. I have always just put in channel, key, and essid stuff. I wonder if its needed when your in a multi AP environment?
If your environment has multiple access points and signal quality variants then the above is the way to dictate the 'ap' to be used;
excerpt from 'man iwconfig';
ap Force the card to register to the Access Point given by the address, if it is possible.
This address is the cell identity of the Access Point, as reported by wireless scanning,
which may be different from its network MAC address. If the wireless link is point to
point, set the address of the other end of the link. If the link is ad-hoc, set the cell
identity of the ad-hoc network.
When the quality of the connection goes too low, the driver may revert back to automatic
mode (the card selects the best Access Point in range).
You may also use off to re-enable automatic mode without changing the current Access
Point, or you may use any or auto to force the card to reassociate with the currently best
iwconfig eth0 ap 00:60:1D:01:23:45
iwconfig eth0 ap any
iwconfig eth0 ap off
Thanks for all the advice. I'm not sure I understand every command but I will try to setup a file. What I don't understand is why the network manager applet doesn't just create this file for you. There are many gui tools that simply edit config files or run simple bash scripts.
I don't understand this syntax. What is ~/# and what is the ' after it?
I would like to point out that wicd now has a console based client, wicd-curses. Works great.
In the past few weeks I've had a few problems with 'wicd 18.104.22.168'. I exclusively used the 'wicd-curses', one day I could not get a known (recognized) ap or any for that matter. I jumped through hoops to get it going. I had to removepkg then installpkg again. I even removed the stale files left behind from the previous install. It worked for a while but then lost everything again. I removed it for now. I don't move this machine and don't need the hassle. I can manually setup without a problem. I think the 'wicd-curses' was available for 22.214.171.124.