Remote Access and Control your Raspberry Pi Anywhere with SSH

Learn how to connect to your Raspberry Pi from outside the local network using SSH, so you can access and control it remotely. …


Updated October 25, 2023

Need help with your Raspberry Pi?
Contact Me!

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


Learn how to connect to your Raspberry Pi from outside the local network using SSH, so you can access and control it remotely.

  1. Enable SSH on Your Raspberry Pi:

    • Open the terminal on your Raspberry Pi and type sudo raspi-config
    • Navigate to Interfacing Options > SSH and enable it by selecting “Yes”
    • Reboot your Pi with sudo reboot
  2. Find Your Raspberry Pi’s IP Address:

    • Connect your Raspberry Pi to the same network as your computer (either wired or wireless)
    • Open a terminal on your computer and type arp -a
    • Look for the device with “b8:27:eb” in its MAC address (this is the default for Raspberry Pi)
    • Note down the IPv4 address next to it, which will be something like 192.168.1.X
  3. Set Up Port Forwarding on Your Router:

    • Log in to your router’s admin panel (usually by typing its IP address into a web browser)
    • Locate the port forwarding settings and add a new rule
    • Set the external (WAN) port to 222 (the default SSH port), internal (LAN) port to 22, and the internal IP address you noted down in step 2
  4. Connect to Your Raspberry Pi from Outside Network:

    • Open a terminal on your computer and type ssh pi@<external_ip> (replace <external_ip> with your router’s public IP address)
    • When prompted, enter the password for the “pi” user, which is “raspberry” by default

Now you have successfully connected to your Raspberry Pi from outside the network. You can run commands and scripts on it just like if you were sitting in front of it. To disconnect, simply type exit or press Ctrl+D in the terminal.

Remember that leaving an SSH server open to the internet can be a security risk, so make sure your Pi is protected with a strong password and firewall rules. Also, consider using a VPN service like ExpressVPN to encrypt your connection further.