DynamicDns
and PortForwarding:
The
ISP provides dynamic public ip address for every customer, dynamic
means change the public ip address of our gateway or wifi router. So
that we can't access the remote Desktop of the raspberry pi from
outsite the local network.
The
first way has the problem that a IP address is hard to remember. And,
if you reboot your router, the IP address will change and you will
have to give the new IP address to your friends, again. Very
unpractical. Having a domain is more user friendly, easy to remember
and does not change over time. The idea is that the domain in always
pointing to your public
IP.
To
resolve this problem, we should use dynamic dns, there are several
sites provides these service called dynamic dns, Let us set Dynamic
Dns for our raspberry pi device.
in
tha above pic. Abutech is the subdomain of the raspctl.com
so
that after register, your domain name is yoursite.raspctl.com
in
my case my domain name is abutech.raspctl.com
now
install raspctl software for raspberry pi. So you put the following
commands on the terminal
wget debrepo.krenel.org/raspctl.asc
then
cat raspctl.asc | sudo apt-key add -
then
echo "deb http://debrepo.krenel.org/ raspctl main" | sudo tee /etc/apt/sources.list.d/raspctl.list
and
then update your pi usig following commands
sudo
apt-get update
then
install the software called raspctl-dynamicdns
using following commands
sudo apt-get install raspctl-dynamicdns
after all is done.
Now you shoud login to your dashboard http://ip.raspctl.com/
you can now see the following pic.
Copy
the UUID from dashboard. Then edit the configuration file
using
the following command
leafpad
/etc/raspctl/dynamic-dns.conf
now
paste the uuid to this configuration file.
Then
save it and exit. Put the following command to update your public ip
to the raspctl.com
sudo
raspctl-dynamicdns
Now
the dynamic dns is successfully installed on your raspberry pi 3.
portforwarding:
now
we should know about port forwarding, your public ip address is
nothing but your router ip address, so that any requests are coming
to your router only, not for your device. So that we should
configure the router for forwarding any requests from the client to
your device.
Open
the router settings in browser using router's private ip, in my case
my router's private ip addess is 192.168.1.1
configure
the router using your raspberry pi ip address then save it.
now the portforwarding is successfully configured.