Your public IP for scripts and DynDNS
Free · no signup
One request, one line: your public IP address as plain text. Made for shell scripts, monitoring and dynamic DNS clients.
$ curl https://vpnxray.com/ip
216.73.216.65
Addresses
https://vpnxray.com/ip— your IP as the server sees it (IPv6 if your connection prefers it, otherwise IPv4)https://v4.vpnxray.com/ip— always your IPv4 addresshttps://v6.vpnxray.com/ip— always your IPv6 address (the request fails if you have no IPv6)
Plain http:// works too, for routers and older devices that cannot use HTTPS. Prefer HTTPS whenever you can: over plain HTTP, a network in between could alter the answer.
Examples
# Linux / macOS
curl https://vpnxray.com/ip
curl https://v4.vpnxray.com/ip
wget -qO- https://vpnxray.com/ip
# Windows PowerShell
(Invoke-RestMethod https://vpnxray.com/ip).Trim()
# Python 3
import urllib.request
ip = urllib.request.urlopen("https://vpnxray.com/ip").read().decode().strip()
Shortcut: curl vpnxray.com (without /ip) also returns your IP when called from curl or wget.
Dynamic DNS (DynDNS)
Dynamic DNS clients need a web address that returns your public IP. With a recent version of ddclient:
# /etc/ddclient.conf
usev4=webv4, webv4=https://v4.vpnxray.com/ip
usev6=webv6, webv6=https://v6.vpnxray.com/ip
With older versions of ddclient:
# /etc/ddclient.conf
use=web, web=https://v4.vpnxray.com/ip
With OpenWrt (ddns-scripts):
# /etc/config/ddns
option ip_source 'web'
option ip_url 'http://v4.vpnxray.com/ip'
On a router or a NAS, look for a field such as “IP check URL” or “IP detection URL” and enter http://v4.vpnxray.com/ip.
Fair use
- Free, no account, no API key.
- Response: the IP address followed by a line break,
text/plain, never cached; cross-origin requests (CORS) are allowed. - Please query at most once a minute: your IP rarely changes. Beyond about 10 requests per minute, the server answers HTTP 429.
- Your IP address is not stored: server logs keep a shortened address for 14 days (see the privacy policy).