What is my IP address?

door

Whenever you want to use TokenDNS you need to know your public ip address. There are many ways to find out what your ip is, but also some wrong ways.

Lets say you want to access you server at home and of course you use only internal ips in your network. That means the local ip cannot be accessed from the internet. We need to know our public ip. For that we can use different ways:

How to get my IPv4 address:

# curl -4 https://ip.tokendns.co
# curl -4 ifconfig.co
# curl -4 ifcfg.me
# curl -4 http://canhazip.com
# curl -4 http://whatismyip.akamai.com
# curl -4 https://ifcfg.me # Valid SSL
# dig +short myip.opendns.com @resolver1.opendns.com 
# nc ifcfg.me 23 | grep IPv4 | cut -d' ' -f4 
# telnet 4.ifcfg.me 2>&1 | grep IPv4 | cut -d' ' -f4
# echo close | ftp 4.ifcfg.me | awk '{print $4; exit}'

How to get my IPv6 address:

# curl -6 https://ip.tokendns.co
# curl -6 ifconfig.co
# curl -6 ifcfg.me
# curl -6 http://canhazip.com
# curl -6 http://whatismyip.akamai.com
# curl -6 https://ifcfg.me # Valid SSL
# nc ifcfg.me 23 | grep IPv6 | cut -d' ' -f4
# telnet 6.ifcfg.me 2>&1 | grep IPv6 | cut -d' ' -f4
# echo close | ftp 6.ifcfg.me | awk '{print $4; exit}'

The easiest way to utilize them is to add them to your cronjobs. For example:

curl --get "https://api.tokendns.co/v1/update" \
  -d apikey=${apikey} \
  -d name=${name} \
  -d content=$(curl -4 https://ip.tokendns.co)

There are plenty of other service providers who allow you to get your public ip address. May be in the future you can use TokenDNS for that too It is now 🙂

Steffen

4 thoughts on “What is my IP address?”

  1. Would be nice if there is also a REST way to passing the parameters in the URL and not as data in http since FritzBox only allows to set a cutsom update url with up to 3 parameters , IP, username and password (though you can name them however u like for example)

    updateurd.de/dyndns.php?pass=&ip=
    or also
    /dyndns.php?APIKEY=&ip=

    but there is no way to influcence the requests header.

Leave a Reply

Your email address will not be published. Required fields are marked *