Difference between revisions of "Port forwarding"
(Created page with "Need description here. --") |
m |
||
(10 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | |||
+ | [[file:pi2.jpg|600px|right|link=https://batchelor-s.com/b/contactus.html]] | ||
+ | [[gufw]] Uncomplicated Firewall (UFW) | ||
+ | check on [[fail2ban]] | ||
+ | set [[rpi]] static [[IP]] | ||
+ | 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 | ||
+ | |||
+ | |||
+ | [[file:C03515.jpg|50px|link=https://batchelor-s.com/b/contactus.html]] | ||
+ | |||
+ | |||
+ | [https://batchelor-s.com/index.php?title=Main_Page --] |
Latest revision as of 19:04, 31 July 2020
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