3

I have a Pi, and with a fresh install, I can configure wifi connectivity using a helpful tool in X windows nicely.

However, what are the command line tools for configuring WiFi? What configuration files are updated?

This isn't critical, but I'd like to know.

  • see here – kolontsov Mar 19 '13 at 4:44
  • That looks like a good answer. Stick it here, and it'll be easier for people to search for it. – DonGar Mar 20 '13 at 17:00
2

Do this, assuming the standard WPA2 necured network:

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Enter this text, replacing the details with yours (id_str is just a comment, you can leave it as-is):

network={
    ssid="TheGarNetwork"
    psk="lollzthisisanexcellentpssword"
    proto=RSN
    key_mgmt=WPA-PSK
    pairwise=CCMP
    auth_alg=OPEN
    id_str="Home_Wi-Fi"
}

CTRL-X, then press Y, then press Enter to save.

Next, type:

sudo nano /etc/network/interfaces

and add this to it:

allow-hotplug wlan0
auto wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

iface default inet static address 192.168.1.128 netmask 255.255.255.0 gateway 192.168.1.1

(allow-hotplug is optional, if you're likely to be unplugging and replugging the adapter, and don't want to have to manually reconnect.)
Fill in the IPs with the appropriate details, or (if you don't want to deal with that,) just replace the word "static" with "dhcp" and delete everything after it.

When you've got that done, reboot and see what happens!

  • I recently switched to a wired connection, and in the process I trashed all my config files. This tutorial was created from memory, with a little help from Google, so please feel free to ask me for help if something doesn't work. (If you currently have a functioning Wi-Fi connection, and see an error in this post, please fix it for me or tell me about it. Thanks!) – JamesTheAwesomeDude May 29 '13 at 0:39
  • ssid, key_mgmt and psk is often enough, the others are automatically detected. – Lekensteyn May 29 '13 at 9:06
0

If you edit /etc/network/interfaces and add these lines :

pre-up wpa_supplicant -B w -D wext -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
post-down killall -q wpa_supplicant

You can then "connect" to your network simply by typing

ifup wlan0

..And disconnect

ifdown wlan0

Saves the user from having to reboot the machine..

Here is where I took it from.. Source

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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