I would like to switch from gnome to awesome and I would like to connect my wifi network in command line (instead of using gnome tools).

So, I searched on the internet and found approximatively the same methods :

ifconfig wlan0 up
iwconfig wlan0 essid "MyNetwork" key THEHEXAKEY
dhclient wlan0

When I run awesome alone and execute those commands, I'm tucked at the 3rd one. It looks like DHCP cannot be resolve (the command continue running endlessly).

But when I run awesome in Xephyr and execute the same commands, dhclient wlan0 works well.

So I suppose Gnome do something that I don"t but I can't find what.

Could someone help me ?

  • Are you sure that you have successfully authenticated and associated with the AP after your iwconfig invocation? You might try manually setting an IP and route to verify that you can send/recieve on wlan0 – Eli Heady Mar 21 '11 at 19:33
  • 3
    You can keep using Network Manager, even if you don't use Gnome. You can run nm-applet in any number of panels. I'm normally a command-line, do-it-myself person, but for networking on a laptop I gave up on doing things manually because Network Manager Just Works on most wifi networks. – Gilles 'SO- stop being evil' Mar 21 '11 at 20:23
  • @Gilles nm-applet is a pretty good solution for the moment. I will wait to configure completly awesome (I saw there is network indicator applets to). Thank you very much. – MARTIN Damien Mar 22 '11 at 8:03
  • 1
    You can also use wpa_supplicant, rather than using iwconfig directy - very handy for encrypted networks. If you do continue to use a manual method of any sort, be sure to stop Network Manager services to save yourself some grief. – Eli Heady Mar 22 '11 at 13:02

I recommend using wpa_supplicant for all connection and AP association procedures. Though the name suggests usage with WPA, it actually is a universal tool for configuring any type of wireless connection.

Here's a complete procedure of connecting to a wireless network, using wpa_supplicant (I assume wlan0 is the name of your wireless device) :

  1. Bring the device up: ifconfig wlan0 up.

  2. List the wireless networks with iwlist wlan0 scan | less and find the network you want to connect to.

  3. Use wpa_supplicant to associate and connect with the network.

    a) Create a config file for wpa_supplicant, containing encryption information about the network. See man wpa_supplicant.conf for examples. Try with simplest entries first.

    b) Run wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant.conf (as root; assuming /etc/wpa_supplicant.conf is the name of the config file). If it works, run it in the background and redirect the output somewhere (I just dump it to /dev/null.)

  4. Use dhclient wlan0 or dhcpcd wlan0 to obtain IP.

  5. PROFIT!

| improve this answer | |

Looks like maybe you're not setting the channel and "mode". I use a simple script that does these shell commands:

ifconfig wlan0 down
iwconfig wlan0 mode managed
ifconfig wlan0 up
iwconfig wlan0 channel 3
iwconfig wlan0 key xxxxxxxxxx
iwconfig wlan0 key restricted
iwconfig wlan0 essid "Blah Blah Foo Bar"
iwconfig wlan0 ap xx:yy:zz:aa:bb:cc
sleep 5
dhcpcd -d wlan0

You have to put in your key, and access point MAC address. This is under Slackware 13.1, and I'm using a WRT54GL running DD-WRT. Much to my shame, I'm using WEP encryption. I had to do some experimenting about when to "ifconfig" and wlen to "iwconfig" and in what order to set ESSID and AP.

| improve this answer | |
  • Is iwconfig wlan0 ap xx:yy:zz:aa:bb:cc The content of 'Cell 01 - Address: 00:19:70:4A:64:ED' when I do iwlist scan? – MARTIN Damien Mar 21 '11 at 21:08
  • Yes, the address listed in the block that also lists your ESSID is your AP's MAC address. This isn't required, but it is good practice if you have only one AP. – Eli Heady Mar 22 '11 at 12:56

Would you please tell us which kind of encryption you use on your router?

You can also try wicd, it's a great connectivity tool and it can work with ncurses interface or gtk (not gnome) frontend. You only run it once, establish a connection, tell wicd to remember it and add wicd daemon to your startup scripts. After that you can just forget about your connection and not run a frontend for months - it will just work. I used it with different distributions and different desktop environments (or standalone WMs) and I'm very happy with it.

| improve this answer | |
  • Your proposition sounds great, I'll try it. Thank you very much. – MARTIN Damien May 24 '11 at 7:37

To get better clues, before you run dhclient, run iwconfig with no arguments. That will display the current wireless status, showing whether you are properly associated with the access point.

If you see Xephyr made a difference, see whether iwconfig reveals that difference. And if still stuck, post your iwconfig results, which should look like http://en.wikipedia.org/wiki/Wireless_tools_for_Linux#iwconfig

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.