Automatically Connect Raspberry Pi to Wi-Fi
12 Feb 2015The Internet. It’s big and exciting but you don’t want to load up a GUI in order to connect to it. There are a couple of ways you can configure your Pi to connect over Wi-Fi when it boots up.
There are just a few things you’ll need:
- Wi-Fi USB adapter for your Raspberry Pi
- Wireless Router
- Working internet connection
It’s probably also a good idea to update your OS if you haven’t done that.
Now go ahead and shutdown your Pi
Plug in your Wi-Fi adapter and boot up the Pi.
One way to set up your connection is to configure you network interface manually. Choose your text editor and open your settings. I use vi here, but nano may be more to your liking. If so, just replace ‘vi’ with nano where you see it below.
Enter in your base configuration for a DHCP connection:
Now you’ll need to enter your network connection information. Open up your WPA configuration.
Here’s an example using a WPA protocol:
If you’re not using DHCP or if you’re wanting to set up multiple connections, you’ll have to do a bit more configuration. You’ll be changing
and
This also shows an example configuration for a static IP.
You would need to enter your work network in your WPA configuration:
Now you can reboot
If your settings are correct you’ll have an internet connection. You can test it out by running
Under you wlan0 output you should see an assigned IP like ‘inet addr:XXX.XXX.XXX.XXX’
If you want to test your settings without rebooting, you can release your connection with
And reconnect with new settings using
WICD-CURSES
There’s an arguably easier route to pursue with wicd-curses. It will give you an interface to select your Wi-Fi connection. It will also allow you to select a network to connect to automatically and enter custom DNS/address/network/gateway settings. Just run
You can navigate with the keyboard and it will provide you with a menu for various options.
If you really don’t want to use the command line, you can always run one or both of the following:
Then start your GUI
Under your internet menu there should be a wpa_config or Wicd Network Manager program to manage these settings.