Skip to main content
Zero dependencies · MIT · Node 18+ or plain curl

IPFerret in your terminal.

Pick a command, fill in the values and copy the exact line, as an npx command or as a curl and jq one-liner that needs nothing installed. The code is open source on GitHub.

Geo, ASN and cloud for 1 to 100 IPs.

Command
npx github:liquidmonks/ipferret-cli lookup 1.1.1.1 8.8.8.8
Sample output (illustrative values)
Public IP   203.0.113.7 (ipv4)
ASN / ISP   AS64496 · Example Transit Ltd
Cloud/CDN   Example Cloud (hosting)
Hostname    host-7.example.net

Nothing here is run or sent. The page only assembles text for you to copy. Addresses and domains you type stay in this tab.

Source, releases and issues: github.com/liquidmonks/ipferret-cli (MIT licence).

What the CLI is for

The web tools on this site answer one question at a time, which is perfect when you are sitting at a browser. A lot of network work is not like that. You are on a server over SSH, inside a CI job, or halfway through a shell script that needs to know which address the outside world sees, who owns the next hop or whether a DNS change has propagated. For those situations IPFerret exposes everything as plain HTTPS endpoints that return JSON, and the command line tool is a thin, readable wrapper around them. There are two ways to use it, and the builder above produces either form:

  • The CLI needs Node.js 18 or newer and nothing else. It has no runtime dependencies, so the whole program is a handful of small files. Run it with npx github:liquidmonks/ipferret-cli, or download the single-file build from the repository and put it on your PATH. On npm 12 and later, which asks before running code from a Git dependency, add --allow-git=all --yes.
  • curl and jq need no installation at all on most Linux and macOS machines. Every online command maps to one endpoint, which makes these one-liners ideal for Docker images and minimal CI runners.

Five commands call the API: ip, lookup, dns, whois and headers. Two run entirely offline: cidr does subnet maths and splitting, including AWS-style reserved-address counts and IPv6, and mtu works out tunnel MTU, TCP MSS and Don't-Fragment ping sizes. They use the same numbers as the subnet splitter and the MTU calculator, so a plan you sketch in the browser can be re-checked in a pipeline. Adding --json to any command prints machine-readable output for jq.

Recipe: check that your split tunnel really splits

Split-tunnel VPN configurations send some destinations through the tunnel and the rest directly. They are easy to get subtly wrong: a missing route, a catch-all AllowedIPs = 0.0.0.0/0 you forgot about, or an app that binds to a specific interface. The quickest test is to ask an external server which address it sees, once with the VPN up and once with it down, and compare. Because curl https://ipferret.com/ip prints only the address, it slots straight into a script:

direct=$(curl -fsS --interface en0 https://ipferret.com/ip)
tunnel=$(curl -fsS --interface utun4 https://ipferret.com/ip)
[ "$direct" != "$tunnel" ] && echo "split tunnel OK" || echo "both paths exit via $direct"

Replace the interface names with your own. To see which organisation owns the exit address, use ipferret lookup "$tunnel" --json | jq .asn or the matching /api/lookup/<ip> call. Pair this with the DNS leak test, because a correct exit address does not prove that DNS queries leave through the same path.

Recipe: find the address your CI job or container really uses

Hosted CI runners, Docker containers and Kubernetes pods almost always reach the internet through NAT, and the address they appear from is not the one on their own interface. That matters whenever you need to add an address to an allowlist, debug a rate limit that blames the wrong client, or confirm that a self-hosted runner leaves through the expected office or data-centre link. A single step in a workflow prints it:

- name: Show egress address
  run: curl -fsSL https://ipferret.com/json | jq '{ip, asn: .asn.asn, org: .asn.name, cloud: .cloud.name}'

Hosted runners are shared and their addresses change, so treat the result as a diagnostic rather than something to put in a firewall rule; for a stable allowlist use a runner or NAT gateway with an address you control. Inside Docker the same line run from a container shows the host's NAT address, which is how you confirm that a user-defined network or a macvlan setup behaves as intended. If the command fails only from inside the container, check DNS and the default route before suspecting the service.

Recipe: enrich a list of log IPs in one request

Web server and firewall logs are full of addresses, and the interesting question is usually who they belong to: a cloud provider, a residential ISP or a hosting network that serves scanners. Doing that one address at a time is slow. The bulk endpoint accepts up to 100 addresses per request. Extract the unique client IPs, send them in batches and read the ASN and organisation from each result:

awk '{print $1}' access.log | sort -u | head -100 > ips.txt
curl -fsSL -X POST https://ipferret.com/api/lookup \
  -H 'Content-Type: text/plain' --data-binary @ips.txt \
  | jq -r '.results[] | [.ip, (.asn.asn // "-"), (.asn.name // "-"), (.cloud.name // "-")] | @tsv'

The response lists results in the order you sent them, and an entry for an invalid address carries an error field instead of failing the whole batch. For longer lists, split the file with split -l 100 and loop, pausing briefly between requests. Please keep batch jobs considerate; the service is free and shared. The same job with the CLI is ipferret lookup $(cat ips.txt) --json. When you then need the registered owner and abuse contact for one noisy address, ipferret whois 203.0.113.7 queries the relevant regional registry through RDAP, the same data behind the WHOIS page.

Recipe: DNS cut-over scripts

Moving a site to a new host usually ends with a DNS change and an anxious wait. The dns command asks a public DNS-over-HTTPS resolver, so you see what the wider internet sees rather than what your own cache remembers. A small loop turns that into a cut-over monitor:

until curl -fsSL 'https://ipferret.com/api/dns?name=www.example.com&type=A' \
  | jq -e '.answers[]? | select(.data == "203.0.113.20")' > /dev/null; do
  echo "not yet"; sleep 30
done
echo "new address is live"

The response has an answers array whose entries carry name, type, data and ttl, so the filter above matches on the record data. Add a loop limit before you rely on it in automation, since a typo in the expected address would otherwise wait forever. Remember that resolvers cache records for the old TTL, so lower the TTL a day or more before the change. The same approach verifies MX, TXT and CAA records after an email or certificate change. For mail, follow up with the email authentication check.

Planning from the shell

The two offline commands are handy in infrastructure repositories. ipferret cidr 10.20.0.0/16 --split 18 lists the four /18 children of a VPC range, and ipferret mtu --link pppoe --tunnel wireguard prints the tunnel MTU of 1432, the TCP MSS and the exact ping to verify it. Because they never touch the network they are safe to run in air-gapped build steps. The preview in the builder above runs the same arithmetic in your browser, so you can see the answer before you copy the line.

Privacy and limits

The CLI has no account, API key or telemetry. It calls only the IPFerret endpoints for the command you run, and the two offline commands make no network request at all. The server-side data handling is described in the privacy policy. If you would rather not depend on the public service at all, set IPFERRET_BASE_URL to your own deployment. As with any free API, large or repeated jobs should be spaced out, and results for an address can change, so do not cache enrichment data for long.

Frequently asked questions

How do I get my public IP address from the command line?

Run curl -fsSL https://ipferret.com/ip for the bare address, or curl -fsSL https://ipferret.com/json | jq for the address with its network and approximate location.

Do I need to install anything to use the API from a script?

No. Every online command is a plain HTTPS request that curl can make, and the JSON answers work with jq. The CLI just adds readable output and shorter commands.

Can I look up many IP addresses at once?

Yes, up to 100 per request, by POSTing a JSON list or newline-separated text to /api/lookup. The CLI's lookup command does this when you give it several addresses.

Does the CLI send my data anywhere other than ipferret.com?

No. Online commands call the IPFerret API only, and cidr and mtu work offline.

Related tools

Prefer a browser? The home page shows your address and network, the DNS lookup mirrors the dns command, and the request headers page shows what ipferret headers returns. Every tool is listed on the tools index.