How to Connect a Raspberry Pi to the Internet

monkey-mascot

In my last post I described why it is fun to have a Raspberry Pi microcomputer at home. In this post I want to show you that you can also connect the Raspberry Pi to the internet. And that doing so is, actually, very easy.

Here is how you can go about it.

Connect the USB Wi-fi Dongle to the Raspberry Pi

Make sure that your USB wi-fi dongle is connected to your Raspberry Pi. I used a Tenda W311MI model and it worked like a charm. I highly recommend it.

Find Out the MAC Address of the USB Wi-fi Dongle

Start up your Raspberry Pi and go to Menu > Accessories > Terminal.

In the Terminal’s window, type and enter the following command:

This command outputs the details of all network connections available on your Raspberry Pi.

ifconfig

ifconfig

We are looking for the MAC address of the wi-fi connection (wlan0), here called HWaddr. This is the MAC address (media access control address) that we are going to allow internet access in the next step. The MAC address is a 12-digit hexadecimal number.

Allow the Raspberry Pi’s MAC Address in the Router

Now, you need to allow the Raspberry Pi’s MAC address in your router.

You will need to do this via a computer that already has an established internet connection. And you will need to know the router administrator’s name and password — your internet service provider (ISP) gave you these when your internet connection was first set up.

Some people don’t use this feature of their routers at all. If you are among those people, you can skip this step altogether.

I use a Cisco EPC3925 router to manage the internet access of the electronic devices in my home. To access the router’s settings, I enter http://192.168.1.1 in a browser and then I enter the admin’s name and password.

There are two places in the router’s settings, where it is possible to list the MAC addresses of devices allowed or denied internet access. The first place is located at Wireless > MAC Filter. And the second at Access Restrictions > MAC Address Filtering.

Cisco — Wireless — MAC Filter

Cisco — Wireless — MAC Filter

Cisco — Access Restrictions — MAC Address Filtering

Cisco — Access Restrictions — MAC Address Filtering

Add the Raspberry Pi’s MAC address to both lists and press the Save Settings buttons.

Configure the Raspberry Pi’s Wi-fi Connection

Return to your Raspberry Pi and go to Menu > Preferences > WiFi Configuration.

You will need to scan your area for all available wi-fi services.

wifi-scan-results

Wi-fi Scan Results

Each wi-fi service has its name, called service set identifier (SSID).

Simply find and select your own SSID in the output list of the scan.

To connect to your wi-fi service, you will need to know the authentication and encryption method used (usually wi-fi protected access — WPA2) and the pre-shared key (PSK).

In case you are not sure what the above-mentioned information are, you can find them out in your router’s settings.

For example, my Cisco EPC3925 router shows me this:

cisco-router-basic-data

Cisco Router Setup

Connect to the Internet

Now you can enter all the necessary information into the Raspberry Pi’s WiFi Configuration tool.

Double-check each entry to make sure that you entered everything correctly.

Once you do this, you will be able to press the Connect button and connect your USB wi-fi dongle with your router and access the internet.

connect-homenet

Connect to a network

Like this:

raspberry-pi-connected

Raspberry Pi connected to the internet

Liked this post?

Subscribe to our newsletter to receive early notification of new posts and deals:

Next Post »« Previous Post

Leave a Reply

Your email address will not be published. Required fields are marked *