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.
Asked
Active
Viewed 58 times
1 Answers
2
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.

bahamat
- 6,263
- 24
- 28