What is my IP address?

Tools

Show on web browser

📑 Show IP addresses list

Get plain text without EOL character

4️⃣ Get IPv4 address

6️⃣ Get IPv6 address

↔️ Get priority IP address 

Usage examples

cURL

Get IPv6 address via eth0

$ curl -s --interface eth0 https://ipv6.ippei.uk/ip/

Wget

Get IPv4 address via specified local IP address and write to the file

$ wget -O addr.txt --bind-address=192.168.1.64 https://ipv4.ippei.uk/ip/

AWS CLI

Update Lightsail DNS record if the IP address is changed

#!/usr/bin/bash

MYDOMAIN=your_domain.tld

MYHOST=hostname.your_domain.tld


all=`aws lightsail get-domain --domain-name "${MYDOMAIN}" --region us-east-1`

now=`echo $all | jq '.domain.domainEntries[] | select(.name == "'${MYHOST}'" and .type=="AAAA")'`

now_ip=`echo $now | jq -r '.target'`

new_ip=`curl -s --interface eth0 https://ipv6.ippei.uk/ip/`

if [ $now_ip != $new_ip ]; then

  new=`echo $now | jq '.target|="'$new_ip'"'`

  aws lightsail update-domain-entry --domain-name "${MYDOMAIN}" --region us-east-1 --domain-entry "$new"

  echo "$now_ip -> $new_ip"

else

  echo "$now_ip"

fi