[Gandi] DNS Dynamique. Box internet : LiveBox Serveur : LAMP sur Raspberry Pi 1) Configuration des règles de NAT/PAT. Activer et configurer la règles NAT/PAT du la Livebox vers le serveur. 2) Répertoire de travail :
pi@longwy ~ $ mkdir DYNDNS
pi@longwy ~ $ cd DYNDNS/
3) Téléchargement du code de source :
pi@longwy ~/DYNDNS $ git clone https://github.com/Chralu/gandyn.git
4) Installation :
pi@longwy ~/DYNDNS $ cd gandyn/src/
pi@longwy ~/DYNDNS/gandyn/src $
pi@longwy ~/DYNDNS/gandyn/src $ sudo python3 setup.py install
pi@longwy ~/DYNDNS/gandyn/src $ cd ../..
pi@longwy ~/DYNDNS $
5) Fichier de configuration : Ouvrir :
~/DYNDNS/gandy.conf
Ajouter :
#API key generated by Gandi
API_KEY = '<api key>'
#Name of the domain to update
DOMAIN_NAME = '<domain name>'
#Time to live of the updated record
TTL = 300
#Filters used to find the record to update.
#By default, the updated record is "@ A xxx.xxx.xxx.xxx"
#Where 'xxx.xxx.xxx.xxx' is the updated value
RECORD = {'type':'A', 'name':'@'}
#Log level of the script. Values are :
# logging.DEBUG
# logging.INFO
# logging.WARNING
# logging.ERROR
# logging.CRITICAL
LOG_LEVEL = logging.DEBUG
#Path of the log file
LOG_FILE = 'gandyn.log'
6) Lancement de Gandyn :
pi@longwy ~/DYNDNS $ gandyn.py --config gandy.conf
7) Erreur : Le script retourne une erreur car la zone DNS du nom de domaine n'a pas d'enregistrement de type A,
Traceback (most recent call last):
File "/usr/local/bin/gandyn.py", line 160, in <module>
main(sys.argv, globals(), locals())
File "/usr/local/bin/gandyn.py", line 142, in main
previous_ip_address = gandi_updater.get_record_value()
File "/usr/local/bin/gandyn.py", line 53, in get_record_value
)[0]['value']
IndexError: list index out of range
Solution :
Nom Type Valeur
@ A 1.2.3.4
[~] ➔ firefox http://<nom de domaine>
10) Lien : https://github.com/Chralu/gandyn