Giter VIP home page Giter VIP logo

rpi-dynamic-dns's Introduction

rpi-cloudflare-ddns

This Python script is designed to update your DNS records with your current external IP address. It uses the Cloudflare API to fetch and update the DNS records for a specified zone.

Disclaimer

This script is currently configured to only update 'A' type DNS records for a single Cloudflare zone. The zone ID is hardcoded in an environment variable, as I only have access to one Cloudflare zone at the moment. If you need to update other record types or manage multiple zones, you will need to modify the script accordingly.

Features

  • Retrieves the external IP address of the machine using the ipify.org API.
  • Fetches the existing DNS records for the specified Cloudflare zone.
  • Updates the DNS records with the new external IP address.
  • Logs all actions to a log file (py_logs.log) for debugging purposes.

Prerequisites

  • Python 3.6 or higher
  • Cloudflare API credentials (API key and zone ID)
  • Environment variables for Cloudflare credentials and zone ID

Installation

  1. Clone the repository:
git clone https://github.com/your-username/rpi-cloudflare-ddns.git
  1. Change to the project directory:
cd rpi-cloudflare-ddns
  1. Create a virtual environment and activate it:
python3 -m venv venv
source venv/bin/activate
  1. Install the required dependencies:
pip install -r requirements.txt
  1. Set the environment variables for Cloudflare credentials and zone ID:
export CLOUDFLARE_API_KEY=your_cloudflare_api_key
export ZONE_ID=your_cloudflare_zone_id
  1. Run the script:
python main.py

Usage

The script will automatically update the DNS records with the current external IP address. You can set up a cron job or a systemd service to run the script periodically to keep the DNS records up-to-date.

License

This project is licensed under the MIT License.

Acknowledgments

rpi-dynamic-dns's People

Contributors

albertribasflix avatar aribasadme avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.