3

Possible Duplicate:
All commands that should be used to connect to wifi in command line

I don't need to configure my wifi card or anything. I just want to do the equivalent of a) listing the wifi devices in my neighbourhood, and b) connecting to one (and setting up the password for it) as I do in the GUI.

Surely there's a command-line command for this?

2
2

I'll 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!

3
  • Doesn't seem I have wpa_supplicant on my machine. :-(
    – interstar
    Nov 11 '11 at 22:39
  • Well, then just install it! You'll certainly find it in your distro's repositories. Nov 11 '11 at 23:22
  • @interstar Just type yum install wpa_supplicant and you will have it.
    – JWF
    Apr 2 '14 at 22:57
0

There's also wicd, which has a text-mode menu-driven frontend wicd-curses which lists the networks and does the setting and dhcp stuff for you.

1
  • Don't seem to have wicd either.
    – interstar
    Nov 11 '11 at 22:39

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