Find IP Address¶
This is not an exhaustive list, but a few methods to try.
Finding a Private IP Address¶
Linux¶
Windows¶
Finding a Public IP Address¶
This is not an exhaustive list, but a few methods to try.
Websites¶
Python¶
python -c "import requests; print(requests.get('https://ifconfig.me').text.strip())"
python3 -c "import requests; print(requests.get('https://ifconfig.me').text.strip())"
Linux¶
curl ifconfig.me
curl ipinfo.io/ip
curl icanhazip.com
curl checkip.amazonaws.com
curl ipinfo.io
curl -s ipinfo.io | jq '.ip'
curl -s https://api64.ipify.org?format=json | jq '.ip'
wget -qO- ifconfig.me
wget -qO- icanhazip.com
wget -qO- ipinfo.io/ip
dig +short myip.opendns.com @resolver1.opendns.com
dig TXT +short o-o.myaddr.l.google.com @ns1.google.com
nslookup myip.opendns.com resolver1.opendns.com
host myip.opendns.com resolver1.opendns.com
AWS EC2 Instances¶
Google Cloud Instances¶
curl http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip -H "Metadata-Flavor: Google"
Azure Virtual Machines¶
curl -H Metadata:true "http://169.254.169.254/metadata/instance/network/interface/0/ipv4/ipAddress/0/publicIpAddress?api-version=2021-02-01" -s
Windows¶
curl ifconfig.me
curl ipinfo.io/ip
curl icanhazip.com
curl checkip.amazonaws.com
curl ipinfo.io | ConvertFrom-Json
(Invoke-WebRequest -Uri "http://ifconfig.me").Content
(Invoke-WebRequest -Uri "https://api64.ipify.org?format=json").Content | ConvertFrom-Json
nslookup myip.opendns.com resolver1.opendns.com
Test-Connection -ComputerName google.com
AWS EC2 Instances¶
Google Cloud Instances¶
curl http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip -H "Metadata-Flavor: Google"
Azure Virtual Machines¶
Invoke-RestMethod -Uri "http://169.254.169.254/metadata/instance/network/interface/0/ipv4/ipAddress/0/publicIpAddress?api-version=2021-02-01" -Headers @{"Metadata"="true"}
Backlinks¶
The following pages link to this page: