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. |
nm-applet is rubbish (the last time I looked) try uninstalling it and using wicd instead.
Otherwise, it is just a matter of editing your /etc/network/interfaces file to bring up the interface(s) you want at boot time. There are lots of HOWTOs on the net. My wireless / wired just comes up at boot, and is ready to use as soon as I am logged on. I only use wicd if I am "roaming". Come back with details of your interfaces file if you get stuck. |
When I first switched to Ubuntu I was using the wireless manager that came with it which didn't really do a good job. Switched to wicd though and now it works great, no issues at all with it.
|
you would want wireless-tools
iwconfig iwlist wlan0 scan iwconfig wlan0 essid <my-router> dhclient |
Hi,
I setup a script for just that; Code:
cat wlan.sh Code:
~#./wlan.sh' :hattip: |
Simple example of /etc/network/interaces for wireless device called wlan0 and access point using WEP encryption.
Code:
auto lo You can manually bring it down with Code:
ifup wlan0 Code:
ifdown wlan0 HTH, Evo2. |
Code:
/sbin/iwconfig wlan0 ap 00:00:00:00:00:00 <<-Your ap |
Quote:
Code:
wireless_ap 00:00:00:00:00:00 Evo2. |
Hi,
Quote:
Quote:
|
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.
Quote:
|
Quote:
wicd however, "just works", (so long as MN hasn't completely messed up the interfaces file) :) As does editing your interfaces file yourself (my preferred method). 90 seconds (and I type slowly compared to many) and the problem is solved. |
Quote:
#!/bin/bash # #10-26-09 13:30 gws #setup the wlan0 device # read -p "Wireless SSID:" ssid read -p "Wepkey:" wep_key read -p "AP( 00:00:00:00:00:00 ):" ap /sbin/ifconfig wlan0 192.168.1.18 /sbin/route add default gw 192.168.1.1 /sbin/iwconfig wlan0 essid $ssid /sbin/iwconfig wlan0 key $wep_key /sbin/iwconfig wlan0 ap $ap |
Oops, missed this bit:
Quote:
What he means is "as root ... (a root shell has a prompt of "#" - try it now, open terminal sudo -i give your password when prompted, you are root, check the bash prompt has changed. exit or close terminal) ... give the command ./wlan.sh The ./ means the file is in the current directory and wlan.sh is the script to be run. HTH |
I would like to point out that wicd now has a console based client, wicd-curses. Works great.
|
Hi,
Quote:
:hattip: |
I try this setting but the result of executing `ifup wlan0' shows
Code:
No DHCPOFFERS received. Code:
allow-hotplug wlan0 I am sure the network works well because I can use other pc (windows) to surf the internet. Also, previously my laptop works well in another wireless which configures using wpa and it worked well without a problem. What is the correct setting for WEP? Or where can I obtain the working sample for WEP setting? Thanks for help. Quote:
|
Quote:
Quote:
Code:
allow-hotplug wlan0 Quote:
From your original post it seems that you are able to use some gui tool to get your wireless working. If so can you please post the output of the following for two cases Code:
sudo iwconfig 2. When it is not working: just after failing to bring it up on the command line. Cheers, Evo2. |
I'm not sure if you typed or copy/pasted your network configuration, but in almost every case of "wireless" you're missing an 'e'. Start by correcting that if you did just copy it.
Since this thread has already been resurrected, cnetworkmanager is another option for users who are already using Network Manager on their systems. It's a command line interface to network manager of course, and fairly simple to use. Ex. cnetworkmanager -C my_ssid --wpa-pass=mypass |
To: tredegar
<Quote>nm-applet is rubbish</Quote> There are people who wrote nm-applet, and with a honest motive of helping the Linux users. I think they deserve a better comment than the above. We may not like a thing but we can be gentle with our criticism. I said this not because i think you are wrong, but beacause of the way you said it. Regards. |
Hi,
Quote:
'PC' is 'BS'! If something is a piece of crap it deserves noted as such. You can rub or spin any way you want but if the feelings or skin of the software programmer is that thin then I suggest they get out. When the kettle is Black, it can be hot too. Touching it will make you aware of one but not the other. :) |
env: kernel 2.6.31/ gcc 4.3.4/ make 3.81/ debian unstable
I double check the related setting again. It looks correct to me, but I think there should have something missing and I am not aware of it. They are follow: Firmware located at /lib/firmware contains Code:
iwlwifi-4965-2.ucode Code:
iwlagn 73340 0 Code:
http://ubuntuforums.org/showthread.php?t=902652&page=2 Code:
iwlagn: Intel(R) Wireless Wifi Link AGN driver for Linux, 1.3.27ks The iwconfig reault Code:
wlan0 IEEEE 802.11abgn ESSID:"TEST" Code:
allow-hotplug wlan0 Thanks for the help. I appreciate it. Quote:
|
To help you I need you to follow instructions.
From my last post: Quote:
Quote:
Evo2. |
All times are GMT -5. The time now is 11:57 AM. |