Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I access the current IP address? Is there a way to execute a program every time it changes? I want to make a program that whenever my IP changes, it will use the Amazon Route 53 API and update a record set with its current IP address. Basically, whenever my IP changes, it will tell amazon where its at so that traffic can be directed to it. I have done some perl, python, go, and bash scripting. Though I'd be most comfortable with python or bash.

share|improve this question
up vote 2 down vote accepted

You can check your current IP with the ifconfig command. However, if you're behind a NAT that won't show you much.

The best you can do is poll something external that will tell you what your translated IP address is. provides a service for doing this. See their IP Automation Rules.

Poll both Route 53 and WhatIsMyIP no more frequently than every 300 seconds. If they are different then update Route 53.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.