If you need to access your home network from the Internet, you need
I describe here, as an example, how to set this up. I limit myself to IPv4, because unfortunately I don't have an IPv6-capable connection.
Let's start with the external IP address problem. The Internet provider, Telekom, Unitymedia, 1&1 etc., provides us with one IP address for our router from the pool of his IP addresses. Since the number of addresses is limited with IPv4 and to ensure fair use, we are assigned a new IP address (usually daily). That means I have to write down this IP address every day. Since this is extremely impractical, some providers provide a so-called dynamic DNS service (often referred to as DynDNS). The idea behind this is to automatically notify the service of a change in IP, which it then manages as a static name.
NOTE - not every Internet connection, pure IPv6 connections that do not have a separate IPv4 address (keyword DS-Lite), can be accessed externally via IPv4.
But now finally we'll come to the head. After DynDNS made their service chargeable, I will now describe how I set up my new provider SPDNS. First you have to create an account, which only requires a working email address.
Once you have registered, you can manage up to 5 addresses free of charge. You start by deciding on a name and domain, in my case this is „onkelhartwig“ in the domain „myfirewall.org“. The Internet address is therefore onkelhartwig.myfirewall.org. During setup, the external IP from which you access the website is automatically suggested. That's about it as far as the DynDNS service is concerned.
If the IP address changes, it must also be updated in the DynDNS service. This can either be the router (not everyone offers the functionality), a PC or a Raspberry Pi. Here I describe the setup on the Fritz Box and on the Raspberry.
From now on, your home network can be reached from the Internet via <selected hostname>.<selected domain> (in my case onkelhartwig.myfirewall.org).
Depending on the router, setting up port forwarding is easy, possible or impossible
I will describe this briefly using the Fritz Box.
Now I can access my Raspberry Pi from the Internet with „ssh -p 4711 firstname.lastname@example.org“. je