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: |
All times are GMT -5. The time now is 06:21 PM. |