Connecting Your Raspberry Pi to the World Wide Web

A step-by-step guide on how to connect your Raspberry Pi to the internet and access it remotely using SSH (Secure Shell) protocol. …


Updated September 20, 2023

Need help with your Raspberry Pi?
Contact Me!

Do you love silly Raspberry Pi Projects?
Check out my this YouTube Channel!


A step-by-step guide on how to connect your Raspberry Pi to the internet and access it remotely using SSH (Secure Shell) protocol.

Remote access is a powerful feature that allows you to control and monitor your Raspberry Pi from anywhere in the world with an internet connection. By connecting your Raspberry Pi to the internet, you can use it as a server or work on projects even when you’re not physically near it. In this article, we will show you how to set up remote access for your Raspberry Pi using SSH (Secure Shell) protocol.

  1. Configuring Your Raspberry Pi

    • First, make sure that your Raspberry Pi is connected to a power source and a network cable. If you are using Wi-Fi, connect it to your local network. You can also use an Ethernet cable to connect your Raspberry Pi directly to your router or modem.
    • Open the terminal on your Raspberry Pi by going to Menu > Accessories > Terminal.
    • Type sudo raspi-config and press Enter to open the Raspberry Pi configuration tool.
    • Navigate to Interfacing Options and enable SSH if it’s not already enabled. This will allow you to connect to your Raspberry Pi using Secure Shell protocol.
    • Exit the configuration tool by pressing Escape until you return to the terminal prompt.
  2. Finding Your Raspberry Pi’s IP Address

    • Open a web browser on your computer and navigate to https://www.whatismyip.com/. This website will tell you your public IP address, which is the address that the internet uses to identify your device. Make a note of this IP address as we’ll need it later.
    • On your Raspberry Pi, type hostname -I and press Enter. This command will display your local IP address on the network. Make a note of this as well.
  3. Setting Up Port Forwarding

    • To allow incoming connections to your Raspberry Pi, you need to forward a port on your router to its local IP address. This is commonly referred to as “port forwarding”.
    • Log in to your router’s admin page by typing the default gateway address (usually 192.168.0.1 or 192.168.1.1) into a web browser and pressing Enter. The default username and password are usually “admin” and “admin”.
    • Navigate to the port forwarding section of your router’s settings, and add a new rule that forwards an unused external port (e.g., 22222) to your Raspberry Pi’s local IP address and SSH port (usually 22).
    • Save the changes and exit the router admin page.
  4. Connecting Remotely with SSH

    • On your computer, open a terminal or command prompt.
    • Type ssh pi@your_public_ip_address -p 22222 and press Enter. Replace “your_public_ip_address” with the IP address you noted earlier.
    • When prompted for a password, enter the default Raspberry Pi password: raspberry. You will be asked to change it on your first login, so make sure to keep track of the new password.
    • If everything is set up correctly, you should now have remote access to your Raspberry Pi! Try running a command like ls to see the contents of your home directory.
    • To exit the SSH session, type exit and press Enter.

Now that you have set up remote access for your Raspberry Pi over the internet, you can connect from anywhere with an internet connection. This is especially useful if you are working on a project that requires constant monitoring or if your Raspberry Pi is located in a remote location. Remember to keep your Raspberry Pi and network secure by using strong passwords and updating software regularly.