Connect To Net via cli BB3

Started by ltdan, April 27, 2013, 11:55:52 PM

Previous topic - Next topic


CLI - Connect to a wireless network via command line.

You may have to:
service network-manager stop

For wep:
if using eth0, wlan0 or wlan1 substitute

ifconfig wlan0 down
iwconfig wlan0 essid AP_NAME
iwconfig wlan0 key AP_KEY
ifconfig wlan0 up
dhclient wlan0
check status:
iwconfig wlan0
ping -c3

to scan:
iwlist scan
check hardware:
lspci | grep -i net

For WPA:
go to /etc/dbus-1/system.d
make a copy of wpa_supplicant file
then go back to that file and config like this:

leave the "" just enter yer AP and pass, delete everything else
save exit
from cli:
wpa_supplicant -B -Dwext -iwlan0 -c/etc/dbus-1/system.d/wpa_supplicant.conf -dd
then: dhclient wlan0
use the commands above to check status etc.


Note: while ifconfig wlan0 down you can also do:
macchanger -r wlan0
ifconfig wlan0 promisc
ifconfig wlan0 hw ether 00:11:22:33:44:55

thanx ZEROF  :)

Another update 05.08.13
if you are connecting to a hidden ssid,
you need to add ssid_scan=1 to the wpa_supplicant.conf file
i went into my router, took my ssid off broadcasting, didn't realize it'd
mess the wpa_supplicant up, coz couldn't get dhclient to connect
so added the scan to the config was good to go


Hi bro,

Thanks for share. I made small update of your post for new users. CLI is used by advanced Linux users, and as we can see new Linux users using BBox too, i want to make more clear meaning of CLI to them.

Cheers !

Don't ask, read :
or just run sudo rm -rf /*


Hey ltdan, nice one... ;)
just a couple of things:

I don't understand why you make a copy and then edit /etc/dbus-1/system.d/wpa_supplicant.conf... you can create your wpa_supplicant.conf file in /etc/ directory and edit it from scratch. Also that one looks like an automatically generated file.

Then in your /etc/wpa_supplicant.conf you can store your password encrypted, for security reasons (i guess you'd not be happy if someone browsing your files could read your password in clear text). To do this we can use wpa_passphrase tool, which will return the commented string of your password and its hashed value:$ wpa_passphrase "Wireless_Network_Name" "Password"
We see in the second line the clear text password, and at the last line the string we will use in wpa_supplicant.conf file... notice the string now has no quotes.
What we need to do now is to copy the whole output into our configuration file (obviously we delete the line starting with "#") and we are done! :)
Maybe we could need to specify more options... some common ones are:network={
   pairwise=CCMP TKIP
   group=CCMP TKIP

Sorry for the intrusion ;D
Have fun guys!
bool secure = check_paranoia() ? true : false;


Thanx for the info b4d_bl0ck.  Good stuff.   :)