VPNXray
简体中文

供脚本和 DDNS 使用的公网 IP

免费 · 无需注册

一次请求,一行结果:以纯文本返回你的公网 IP 地址。专为 Shell 脚本、监控和动态 DNS 客户端设计。

$ curl https://vpnxray.com/ip
216.73.217.51

接口地址

也支持普通的 http://,适用于无法使用 HTTPS 的路由器和旧设备。请尽量使用 HTTPS:在普通 HTTP 下,中间的网络可能篡改返回结果。

示例

# 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()

快捷方式:用 curl 或 wget 访问 curl vpnxray.com(不带 /ip)也会返回你的 IP。

动态 DNS(DDNS)

动态 DNS 客户端需要一个返回公网 IP 的网址。使用较新版本的 ddclient:

# /etc/ddclient.conf
usev4=webv4, webv4=https://v4.vpnxray.com/ip
usev6=webv6, webv6=https://v6.vpnxray.com/ip

使用旧版本的 ddclient:

# /etc/ddclient.conf
use=web, web=https://v4.vpnxray.com/ip

使用 OpenWrt(ddns-scripts):

# /etc/config/ddns
option ip_source 'web'
option ip_url 'http://v4.vpnxray.com/ip'

在路由器或 NAS 上,找到类似“IP 检测网址”或“IP check URL”的设置项,填入 http://v4.vpnxray.com/ip。

合理使用