Port forwarding
gufw firewall
check on Fail2ban
set rpi static IP
192.168.1.1
router
Service Port: This is the external port.
IP Address: This is the IP of the Pi.
Internal Port: Set this to Pi’s application port. (A web server runs on port 80 for example)
Protocol: Set this to ALL unless specified.
Status: Set this to enabled.
install the DDclient to update dynamic DNS
sudo apt-get update
sudo apt-get install ddclient libjson-any-perl libdata-validate-ip-perl
wget https://files.pimylifeup.com/portforwarding/ddclient-3.9.0.tar.gz tar -zxvf ddclient-3.9.0.tar.gz
sudo cp -f ddclient-3.9.0/ddclient /usr/sbin/ddclient
sudo mkdir /etc/ddclient
sudo mv /etc/ddclient.conf /etc/ddclient
sudo nano /etc/ddclient/ddclient.conf
Add the following to below the commented header in the file, also remove anything else in the file. We will add more to the file later on with our guides on using No-IP or Cloudflare.
use=web, web=checkip.dyndns.com/, web-skip='IP Address' ssl=yes
CloudFlare and No-IP is that you need to own a domain name to make use of CloudFlare. No-IP However offers free subdomains, meaning it’s a costless service to use.
Cloudflare also offers more protection such as free SSL, anonymized IP, DDOS protection
protocol=cloudflare
server=api.cloudflare.com/client/v4
login=your_email
password=your_api-key
zone=your_domain.com
anything.your_domain.com
sudo /etc/init.d/ddclient restart
You may need to turn off the Cloudflare proxy
Running ddclient as a Daemon
sudo nano /etc/default/ddclient
run_daemon="true"
run_dhclient="false"
run_ipup="false"
sudo service ddclient start
sudo service ddclient status
sudo nano /etc/cron.weekly/ddclient
- !/bin/sh
/usr/sbin/ddclient -force
sudo chmod +x /etc/cron.weekly/ddclient
debug
sudo ddclient -daemon=0 -debug -verbose -noquiet