So you have setup your Raspberry Pi got a website running on it, but you can only reach it from the local network.
In this guide we will open the Pi so the whole internet can reach it.
This part is a bit tricky. Because it’s depending on third parties. And they all work a bit different. The big stokes are the same for everyone but the how will differ a bit. This step can also be done later.
Opening the router to the outside world.
You need to login into your modem which your ISP provided to you. How to do that might differ per modem. But usually it will be an ip which start with
192.168.x.x To help you get started. A few pointers.
- Inspect the modem. Look for passwords and model type.
- Google the modem type, this will help with the ip and maybe the default login credentials.
- Some still have default passwords, instead of random generated.
- Call your ISP, it’s there modem they should be able to help.
Once you are in the modem settings we are going to do a thing called port-forwarding. I had a lot of problems figuring this out. Because of that I’m going to refer you else where. Keep in mind the following.
- You will need to forward it to the hostname or the internal IP used by the Pi. If you need the IP see below to give a static IP. The hostname you can get with
- The ports we are talking about should be 80 for http and 443 for https.
- If you want too login to ssh remote secure your remote and forward port 22 for ssh.
- You might need something called “TCP”
- I needed to fiddle with a setting “DMZ Host”network
- If you are struggling google port-forwarding with your modem
As I said this is really not my piece of pi, so here is a better guide: HowToGeek guide
Adding a domain name
First you will need to register a domain name. There are a lot of these registrars as they are called. I’m not going to recommend any because I registered all my domains at a Dutch company. One registered you will need to add a DNS A-record that will point to your home IP.
You can get your home network IP with the following command:
wget http://ipinfo.io/ip --timeout=3 --tries=1 -qO -
To test if your url is working run:
ping example.com -c 5
It should return something like this, with your home IP:
5 packets transmitted, 5 received, 0% packet loss, time 1000ms