What is my IP address?

Posted by ads' corner on Thursday, 2014-04-10
Posted in [Software]

For a number of reasons it is nice to know your own IP-address. If you are behind a firewall or a NAT system, you usually only have a private IP-address and “someone else” on the internet needs to tell you your official IP-address.

Given what usually happens with free services - they are closed once in a while - and with freemium services - they change the business modell - I decided to run my own service. After all, it’s not that complicated, and it integrates well into my own Dynamic DNS service.

What do you need to run such a service?

  • A webserver with the ability to run scripts
  • A small script
  • Optional: a domain or subdomain

Since I already use updates.domain for my own Dynamic DNS service, I decided to use this subdomain for the “what is my IP address” service as well. As scripting language I use PHP here.

Decide yourself if you want to integrate this into the “index.php” or use another name. The script itself is ridiculous easy:

1
2
3
4
5
<?php

print $_SERVER['REMOTE_ADDR'];

?>

Whenever you enter the URL into a browser, it returns your current official IP-address - and nothing else. No advertising, no Captcha, just the address. Usage in a script is very easy as well:

1
lynx -source -dump http://updates.domain/my_ip.php

Categories: [Software]
Tags: [Dynamic-Dns] [Dyndns] [Lynx] [Nat] [Php] [Script] [Skript]