How to create a code that reads and writes my IP into a zone file
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How to create a code that reads and writes my IP into a zone file
Hi
I'm using CentOS 6, Apache, and BIND DNS.
BIND doesn't allow me to assign a CNAME record to a root-name (@ CNAME abc.abc.com), only an A record, but I have a dynamic IP address.
I think about creating a code that detects my external IP address every 60 minutes for example, and if the IP changed - update the zone file (example.com.zone).
A better explanation:
IP1 is inside the zone file: @ A IP1;
I restart my router, my IP changes.
The code runs, detects the new IP (IP2), writes it to the zone file
IP2 is inside the zone file: @ A IP2;
Do you know if it's possible? can I do it with PHP or PERL? I'm new with Linux, and I'm not sure it's even connected to Linux. Oh and don't worry: My domain is ALWAYS pointing to the right DNS server: I'm using DynDNS for that.
I'm not sure it's in the right forum or even the right website but any answer will be good!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.