Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

dynamic.py is a script that resolves a domain name to an IP address, then adds that IP address to your /etc/hosts file.

Notifications You must be signed in to change notification settings

nickodell/dynamic-hosts

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

dynamic.py

dynamic.py is a script that resolves a domain name to an IP address, then adds that IP address to your /etc/hosts file.

Motivation

I log into my home server remotely, and I need to have a way to find its new IP address if it changes. I set up a dynamic DNS address, but it's cumbersome to type the whole thing.

Usage

dynamic.py will read your /etc/hosts file and look for special directives that tell it what domain names to look up.

The basic pattern is a pound, followed by the domain name you want to resolve, followed by one or more aliases that you want to resolve to the domain name, followed by the keyword DYNAMIC.

Example:

#subdomain.dynamic-dns.tld	server1-ext	nas1-ext	DYNAMIC

dynamic.py will change that to something like this:

#subdomain.dynamic-dns.tld	server1-ext	nas1-ext	DYNAMIC
70.71.72.73	server1-ext	nas1-ext # dynamically resolved

Then, I add dynamic.py to root's crontab, like so:

*/30 * * * * /path/to/dynamic.py

This re-resolves the domain name frequently enough for my purposes.

About

dynamic.py is a script that resolves a domain name to an IP address, then adds that IP address to your /etc/hosts file.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.