Page 1 of 1

WiFi set up from terminal

Posted: Mon Apr 29, 2013 8:18 pm
by macey
Hello, can anyone here guide me through wifi configuration from the terminal? I don't have an
X session avail as accessing remotely.
Anyway, how would I do it via "Desktop" environment? I may be able to talk my wife through it ;)

Help appreciated.

Re: WiFi set up from terminal

Posted: Tue Apr 30, 2013 12:06 pm
by macey
unashamed bump.

Re: WiFi set up from terminal

Posted: Tue Apr 30, 2013 12:44 pm
by Joe Schmoe
Your post seems inconsistent. My first reaction upon reading it was that you wanted to know how to get WiFi up and running via Linux commands (as opposed to clicking in a GUI). That, I can help you with (and will, should you further request it). But then you say something about "doing it from a Desktop enviroinment", which seems to contradict the previous assumption.

Please clarify.

Re: WiFi set up from terminal

Posted: Tue Apr 30, 2013 1:05 pm
by macey
Thanks for your reply. Sorry to be so confusing... Your first assumption is correct, I want to set up wifi
from the command line (as a first preference). I am only able to access to RasPi remotely. I gave the second option as a "last resort". My wife is on site with the RasPi and I 'may' have been able to
talk her through the desktop procedure.

Back to the first option please, Linux command line.
Thanks in anticipation.

Re: WiFi set up from terminal

Posted: Tue Apr 30, 2013 2:25 pm
by texy
I would connected it to the TV/monitor and set it up with X. Once it's done, it's done - it's a one-off operation.
However the reason for that as my preference is that I have the option to do so - and the other thing is that I don't know HOW to do it from command line :roll:

Sorry that wasn't very helpful.

Texy

Re: WiFi set up from terminal

Posted: Tue Apr 30, 2013 2:57 pm
by macey
You obviously haven’t read my post correctly, I am accessing the RasPi REMOTELY, ie, other
side of the world, kind of difficult for me to do via X. :lol:

Re: WiFi set up from terminal

Posted: Tue Apr 30, 2013 3:03 pm
by texy
Not at all - I understand fully. Let me re-phrase it - get your wife to connect it up to the TV ;)

T.

Re: WiFi set up from terminal

Posted: Tue Apr 30, 2013 3:09 pm
by Davespice
You can try this post;
http://www.raspberrypi.org/phpBB3/viewt ... 26&t=40164

You can also install a VNC server on the Pi and then use your SSH client to tunnel the connection.
That would give you desktop access too.

Re: WiFi set up from terminal

Posted: Tue Apr 30, 2013 3:23 pm
by macey
Yes, I am aware of that, I don't want to do that, I prefer to use the command line. You learn more that way. I think i'll wait for the first person to reply to come back.
Thanks anyway.

Re: WiFi set up from terminal

Posted: Tue Apr 30, 2013 3:56 pm
by Joe Schmoe
macey wrote:Yes, I am aware of that, I don't want to do that, I prefer to use the command line. You learn more that way. I think i'll wait for the first person to reply to come back.
Thanks anyway.
Thanks. I'm glad you said that - that you really do want to learn stuff, not just "git'er done".

It's amazing how much, even on a board dedicated to an educational product (the Pi), there still seems to be a preponderance of that all-too-common-on-support-boards "git'er done" mentality.

But, just to be clear, if the goal is just to "git'er done", then, yes, talking your wife through using the GUI is probably the fastest way to get her surfing.

Anyway, here's how I do it (on a per-boot basis - i.e., in /etc/rc.local):

1) killall -v wpa_supplicant dhclient || :
2) ifconfig wlan0 up
3) wpa_supplicant -B -i wlan0 -c wpa_supplicant.conf
4) dhclient wlan0

where "wpa_supplicant.conf" is like:

network={
ssid="yourWifiNetwork"
psk="yourPassword"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
auth_alg=OPEN
}

Now, that's the easy part. The hard part is that if you do this, you will get messed up by the "built-in" networking. Because behind the scenes, the great and powerful Oz is running these same programs, trying to do everything for you. It's like having both an automatic and a standard transmission on the same car. Chaos ensues.

So, you need to turn off the built-in stuff, and that's not made easy for you. But again, it is a learning experience. I can't remember right now how I did it - it was something like "services networking disable" or something like that.

And then I found that once you've done that (and rebooted), you don't have the "lo" (loopback) device, since that is enabled by the "built-in" networking. So, I added:

ifconfig lo 127.0.0.1

to the end of /etc/rc.local.

P.S. Curiously, the loopback device is not really needed much anymore - except for one thing. X needs it for TCP/IP listening (which nobody really uses much anymore either). So, for the most part, you won't miss it. As it happens, I had been running for quite some time without it, until I was trying to get X to work with TCP/IP and kept banging my head against the wall wondering why it wasn't working - until I figured out that I didn't have the loopback device.

Re: WiFi set up from terminal

Posted: Tue Apr 30, 2013 4:04 pm
by SirLagz
or you can put in these few lines into /etc/network/interfaces

Code: Select all

auto wlan0
iface wlan0 inet dhcp
wpa-ssid YOURSSIDHERE
wpa-psk YOURPASSPHRASE HERE
These lines are also listed in the post that davespice linked.