Learn how to access your Raspberry Pi from anywhere with this simple step-by-step guide.

Ever wanted to control and monitor your Raspberry Pi remotely? Whether you are at work, on vacation or simply want to keep an eye on your home automation system, remote accessing a Raspberry Pi over t …


Updated October 4, 2023

Need help with your Raspberry Pi?
Contact Me!

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


Ever wanted to control and monitor your Raspberry Pi remotely? Whether you are at work, on vacation or simply want to keep an eye on your home automation system, remote accessing a Raspberry Pi over the internet is essential. In this article, we will walk you through the process of setting up remote access to your Raspberry Pi using popular tools and techniques.

Preparing Your Raspberry Pi for Remote Access

Before getting started with the actual setup, ensure that your Raspberry Pi is running the latest version of Raspbian operating system and it is connected to a stable internet connection.

Enable SSH (Secure Shell) on Raspberry Pi

SSH (Secure Shell) allows you to remotely access and control your Raspberry Pi from another device over the internet. To enable SSH, open the terminal window and type:

sudo systemctl enable ssh

After enabling SSH, reboot your Raspberry Pi using the following command:

sudo reboot now

Find Your Raspberry Pi’s Local IP Address

To remote access your Raspberry Pi, you will need its local IP address. Open a terminal window and type:

hostname -I | awk '{print $1}'

This command will output the local IP address of your Raspberry Pi. Make a note of this IP address as it will be used in the next step.

Set Up Dynamic DNS (Optional)

Dynamic DNS is an optional step, but recommended if you do not have a static IP address. Dynamic DNS allows you to access your Raspberry Pi using a domain name instead of an IP address, which is easier to remember and does not change even if your internet service provider assigns a new IP address.

  1. Sign up for a dynamic DNS service like DuckDNS (https://www.duckdns.org/).
  2. Follow the instructions on the DuckDNS website to install their client on your Raspberry Pi.
  3. Update the ~/.duckdns file with your domain name and token information.
  4. Start the DuckDNS service:
sudo systemctl enable duckdns
sudo systemctl start duckdns

Setting Up Port Forwarding on Your Router

Port forwarding is a networking concept that allows incoming connections to your router to be directed to a specific device within your local network. To set up port forwarding, follow these steps:

  1. Log in to your router’s admin panel using a web browser (usually by typing http://192.168.0.1 or http://192.168.1.1 into the address bar). The default username and password are usually admin and admin.
  2. Navigate to the port forwarding settings page. This is typically located under “Advanced Settings” or “NAT/QoS”.
  3. Create a new port forwarding rule with the following parameters:
    • External Port: Choose any port number between 1024 and 655359 (e.g., 50000).
    • Internal Port: Use the same port number as the external port (e.g., 50000).
    • Protocol: Choose either TCP or UDP, depending on your preference.
    • IP Address: Enter the local IP address of your Raspberry Pi that you obtained earlier (e.g., 192.168.0.10).
  4. Save and apply the changes to your router settings.

Remote Accessing Your Raspberry Pi from Another Device

Now that your Raspberry Pi is set up for remote access, you can connect to it using an SSH client on another device. Follow these steps:

  1. Install an SSH client on your computer or mobile device. For Windows users, you can use PuTTY (https://www.putty.org/), while macOS and Linux come with built-in SSH clients.
  2. Open the SSH client and enter the following information:
    • Host Name (or IP address): Use your domain name if you set up Dynamic DNS or your router’s public IP address (you can find this on websites like https://www.whatismyip.com/).
    • Port: Use the external port number you defined in the port forwarding step (e.g., 50000).
    • Username: Enter pi (the default username for Raspbian).
    • Password: Enter your Raspberry Pi’s password (raspberry by default).
  3. Connect to your Raspberry Pi and start remotely controlling it!

Remember, if you have set up dynamic DNS, be sure to use the domain name instead of the IP address in the SSH client. Also, make sure that your router’s port forwarding settings remain intact so you can continue accessing your Raspberry Pi from anywhere.