Port forwarding
gufw Uncomplicated Firewall (UFW)
check on fail2ban
router
192.168.1.1
Service Port: This is the external port.
IP Address: This is the IP of the rpi
Internal Port: Set this to rpi’s application port.
Protocol: Set this to ALL unless specified.
Probably need to change this
80 web
22 SSH
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
NO-IP offers free subdomains
CloudFlare you need to own a domain name
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