[CentOS] Activating Wireless from command line

Tue Jan 24 03:17:09 UTC 2012
david <david at daku.org>

Folks

Is there a way in CENTOS6 to define and turn on wireless from the 
command line.   My environment is as follows:

I'm trying to build a laptop for travel, and have KVM-guests for both 
Linux Gui and Windows, using internal NAT networking.  The underlying 
host machine doesn't really need to be much more than a NAT provider, 
and the usual command-line utilities.

When I arrive at a new location, and have the network ID and password 
in hand, I don't mind executing some kind of script (on the host) to 
create the connection.  But when I return to that network weeks 
later, it should be very easy to complete the connection.  This needs 
to be done in the host machine, not in the clients.

So far, I've figured out the following:

I issued the following
   iwconfig wlan0 up

(Manually I issued
    iwlist wlan0 scan | grep ESSID
    and identified the right network
)

I then issued
wpa_passphrase {ename} "{pass-phrase}" >> 
/etc/wpa_supplicant/wpa_supplicant.conf

where {ename} is the name of the network, case sensitive
and {pass-phrase} is the same as I would enter in the GUI interface, 
if I wanted to use it.

What more is needed?  I really want to avoid GUI interfaces if possible.

Thanks
David Kurn