DEV Community

Amin Imani (iman)
Amin Imani (iman)

Posted on

How to Get IP, ASN, and Network Information with curl (No API Key Required)

If you work with infrastructure, servers, or networking, you probably look up IP addresses more often than you’d like.

Sometimes you just need to quickly answer questions like:
• What ASN does this IP belong to?
• What network (CIDR) is it part of?
• Where is it located?
• Which organization owns it?

Most IP lookup tools are built for browsers. They’re heavy, full of ads, or require an API key.

But what if you just want something simple that works directly from your terminal?

The Problem with Most IP Lookup Services

When you try to fetch IP data programmatically, you usually face one of these issues:
• API keys required
• Rate limits with complicated plans
• Noisy JSON responses
• Slow dashboards meant for humans, not scripts

For automation workflows, monitoring scripts, or quick debugging sessions, this adds friction.

Sometimes you just want:

curl <endpoint>
Enter fullscreen mode Exit fullscreen mode

And get clean, predictable output.

A Simple Way to Get IP Information from the Terminal

You can use:

curl https://ipkit.ir
Enter fullscreen mode Exit fullscreen mode

This returns structured information about your IP address, including:
• IP address
• CIDR network
• ASN
• Organization
• Country
• City
• Timezone

If you want information about a specific IP:

curl https://ipkit.ir/8.8.8.8
Enter fullscreen mode Exit fullscreen mode

The output is designed to be readable for humans and predictable for scripts.

JSON Output for Automation

If you’re integrating this into a script or backend service, you can request JSON:

curl https://ipkit.ir/json
Enter fullscreen mode Exit fullscreen mode

Or for a specific IP:

curl https://ipkit.ir/8.8.8.8/json
Enter fullscreen mode Exit fullscreen mode

This makes it easy to pipe into tools like jq:

curl https://ipkit.ir/json | jq -r .asn
Enter fullscreen mode Exit fullscreen mode

Now you can use IP and ASN data directly in:
• Bash scripts
• Monitoring systems
• CI/CD workflows
• Security automation
• Logging pipelines

Example Use Cases

Here are a few practical scenarios:

  1. Debugging Infrastructure Issues

You see an unknown IP in your logs. Instead of opening a browser, you run:

curl https://ipkit.ir/<ip>
Enter fullscreen mode Exit fullscreen mode

Instantly see ASN and network ownership.

  1. Filtering Traffic by ASN

In abuse detection or rate-limiting logic, ASN data can help identify traffic sources. You can fetch the ASN and apply rules accordingly.

  1. Enriching Logs

You can enrich raw IP logs with network metadata using a simple script that calls an IP lookup endpoint and appends ASN or location info.

Why Simplicity Matters

Tools that work well in the browser don’t always work well in automation.

The goal behind ipkit was simple:
• No authentication required
• No heavy UI
• Predictable output
• Works equally well in a browser or in curl

Sometimes the best tools are the ones that stay out of your way.

Final Thoughts

If you frequently deal with IP addresses in your workflow, having a fast and script-friendly lookup tool can save time and reduce friction.

You can try it here:

https://ipkit.ir

If you have suggestions or use cases, I’d be interested to hear how you’re handling IP lookups in your infrastructure.

Top comments (0)