M HYPE SPLASH
// general

Using Google Dynamic DNS with a Raspberry Pi

By Emma Terry

I'm having some trouble hosting a website with my Raspberry Pi. I followed this tutorial.

What I did was the following:

  • Purchased a .dev domain with Google Domains.
  • Installed Apache2 on my Raspberry Pi. This seems to be working because when I access my Pi's local IP while connected to my network, I get the Apache default page
  • Set up port forwarding. I have an Xfinity router, so I went to 10.0.0.1 (the default local address to configure Comcast equipment) and set port forwarding with my Raspberry Pi for port 80 using TCP/UDP. Apparently this works, because when I access my WAN IP address (is this the correct term?) my browser sends me to the Apache default page on the Pi.
  • Created a Dynamic DNS using Google Domains and created a script that updates the DNS IP when my WAN IP changes using an API provided by Google. This works and the Google Domains website shows the correct IP address linked to the domain (the same one I used to access my website in the previous step).
  • Waited a little while and checked with some DNS propagation checkers that the change had taken place.

Now when I try to access my website, first I get a Chrome warning screen saying Your connection is not private and the error code NET::ERR_CERT_COMMON_NAME_INVALID. I managed to bypass this by typing thisisunsafe in the browser. When I do this, I get sent to my router's config instead of my website. It seems to me as if the port forwarding isn't working, so I'm getting stuck at my router and it never sends me to my Raspberry Pi. However, I am a beginner with web stuff so I'm just guessing.

How can I get my domain to point to my Raspberry Pi?

2

1 Answer

Accessing anything on your local network from the external IP address of your internet service will always present your router configuration page unless the router has NAT Hairpinning/Reflection set up due to the way NAT works.

This diagram illustrates what's happening at the moment

 +--------------ROUTER-----------------------+ +------DNS-----------+ | | | | | | | Domain.dev |
Your PC | Router Internal IP Router External IP | | 1.2.3.4 |
10.0.0.2+ | 10.0.0.1 1.2.3.4 ^ | | | +^+ | | | | | ||>>>>>>>>>>>>>>>>>>>>>> 3) PC Navigates to IP Address| | | ||<<<<<<<<<<<<<<<<<<<<<< 2) DNS Server returns External IP<<<<<+ | +->>>>>>>>>>>>>>>>>>>>>> 1) DNS Lookup for Domain Name>>>>>>>> +--------------------+ | | +-------------------------------------------+

Without NAT Reflection, the PC gets directed to the router's external IP Address, as it should, and the router will respond to any requests to either internal or external interfaces with the router login page.

What NAT reflection does is allow the router to recognise that the 3rd step in the diagram above is coming from a host talking to the internal IP Address

The router will then apply the same rules on both the Internal and External interfaces when it port forwards, thus allowing you to access internal resources from the external IP Address even when you're talking to the internal IP Address

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy