PDA

View Full Version : Manually Connecting to Open and WPA Wireless Network via Command Line



Eunix
2014-03-27, 20:48
So I just spent a few days trying to manually connect to my wireless router (i.e. not using the GUI) and finally got it to work. The problems I was having seemed to be a result of the GUI-Network Manager overriding and/or interfering with my manual attempts to connect.

A few things: I am using a 64 bit Live USB disk to run Kali, so modifying some of my network files and rebooting was not an ideal option, I wanted to be able to do it on the fly. Also, I am currently just using this for an open wireless router -- I haven't got this to work on a WPA router or my 3G/4G phone modem yet. Maybe someone can help? [EDIT: now working on WPA2 router]

Also fyi, I am fairly new to Linux so this may be a simple fix for many, but I did notice a large number of posts about this on the internet with similar problems so perhaps it will be useful.

I also referred to this post (http://forums.kali.org/showthread.php?17992-Connect-To-Internet-via-Command-Line&highlight=0pt1k), which helped some but seemed to have a few errors (i.e. killall network-manager is not a working option).

Here's what I did (Open network):



service network-manager stop
service networking stop
killall wpa_supplicant
killall dhclient


These steps basically seemed to have removed the hooks to the command line interface that was screwing me up and essentially giving me a blank field to work with.

Next (my USB Alfa is on wlan1)



ifconfig wlan1 down
iwconfig wlan1 essid "ENTER YOUR SSID HERE"
ifconfig wlan1 up
dhclient wlan1


At this point I pinged google and had a successful network connection.

To get this to work on a different access point I had to stop stop the networking service again and killall the dhclient before running the second block of code.

---
WPA protected router

For this I referred to this post (http://linuxcommando.blogspot.com/2013/10/how-to-connect-to-wpawpa2-wifi-network.html).

I'm not sure it is worth repeating here.

However, I did killall/stop services as above first, which I think is an important part. I did receive some errors after entering "wpa_supplicant -B -D wext -i wlan1 -c /etc/wpa_supplicant.conf", the error being "ioctl[SIOCSIWENCODEEXT]: Invalid argument." However, it still worked. I'm not sure what the error refers to.

Hope this helps.

I am still trying to figure out how to manually connect to the 3G/4G modem on my Droid Razr running FoxFi




-e