Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

1 Answer 1

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. WhatIsMyIP.com 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
add comment

Your Answer

 
discard

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.