Physical Address
Metro Manila, Philippines
Physical Address
Metro Manila, Philippines
You have an IP address in an NGINX log, firewall alert, DNS query log, SIEM event, or traceroute.
You know the address.
But who operates the network behind it?
That is where an IP to ASN lookup becomes useful.
An IP ASN lookup can help you determine which Autonomous System is announcing the network prefix containing an IP address. For a sysadmin, network engineer, DevOps engineer, or SOC analyst, this gives you more useful context than the IP address alone.
Instead of seeing:
IP: <PUBLIC_IP>you may be able to determine:
IP: <PUBLIC_IP>
Prefix: <ROUTED_PREFIX>
Origin ASN: <ASN>
Network: <NETWORK_NAME>
Registry: <RIR>That can help answer questions such as:
This guide explains what an ASN is, how IP addresses become associated with Autonomous Systems, and how to perform practical ASN lookups from Linux.
It also explains an important limitation:
An ASN identifies a network routing domain. It does not identify an individual person.
An Autonomous System, usually shortened to AS, is a network or group of networks operated under a common routing administration.
The Internet is not one network.
It is a large collection of independently operated networks exchanging routing information with each other.
Those networks may belong to:
BGP, or Border Gateway Protocol, is the protocol used between these networks to exchange routing information.
RFC 4271 defines an Autonomous System in terms of a set of routers under a common technical administration that presents a coherent routing policy to other Autonomous Systems.
Each public Autonomous System normally has an Autonomous System Number, or ASN.
You will commonly see an ASN written like this:
AS64496or simply:
64496Modern BGP supports four-octet, or 32-bit, AS numbers. RFC 6793 extended BGP beyond the original two-octet ASN space.
IANA manages the global ASN number space and allocates ASN blocks to the five Regional Internet Registries:
The RIRs then assign or allocate ASNs according to their regional policies. The Philippines falls within the APNIC service region.
The easiest way to understand an IP-to-ASN lookup is to follow the relationship between five things:
IP address
|
v
Network prefix
|
v
BGP route announcement
|
v
Origin ASN
|
v
Network operatorConsider a documentation-only example:
IP address:
203.0.113.25
Containing prefix:
203.0.113.0/24
Origin:
AS64496
Operator:
Example NetworkThe IP address identifies one address.
The prefix represents a block of addresses.
A network advertises reachability for that prefix through BGP.
The Autonomous System originating that BGP route has an ASN.
An IP-to-ASN database uses routing information to build this relationship:
203.0.113.25
|
v
203.0.113.0/24
|
v
BGP announcement
|
v
AS64496The values above are documentation examples. They are deliberately not real ownership claims. RFC 5737 reserves 203.0.113.0/24, along with 192.0.2.0/24 and 198.51.100.0/24, for IPv4 documentation. RFC 5398 reserves specific AS number ranges for documentation as well.
When someone asks:
What is the ASN of this IP?
they usually mean:
Which Autonomous System currently originates the BGP route covering this IP address?
That wording matters.
An IP address itself does not permanently contain an ASN.
The association is derived from routing information.
For example:
IP
|
v
Find most-specific visible BGP prefix
|
v
Find AS originating that route
|
v
Return origin ASNThat origin may change.
This is why IP-to-ASN information should be treated as routing intelligence rather than a permanent attribute embedded in an address.
This is one of the most important distinctions when performing an ASN lookup.
Two different questions are often mixed together.
WHOIS and RDAP are useful here.
Regional Internet Registries maintain registration information about:
APNIC, for example, maintains inetnum, inet6num, and aut-num records for Internet number resources in the Asia-Pacific region.
For this, you want BGP routing data.
Useful sources include:
These observe routing information rather than only resource registration.
The distinction looks like this:
RDAP / WHOIS
|
+--> Who is this resource registered to?
BGP routing data
|
+--> Which ASN is currently originating this prefix?Those answers can be different.
For example, address space may be registered to one organization but announced by:
So if your question is specifically IP to ASN, BGP origin information is usually the stronger signal.
Use RDAP or WHOIS to add registration context.
One of the easiest command-line methods is Team Cymru’s public IP-to-ASN mapping service.
The service maps an IP address to information including:
Team Cymru states that its mapping service uses BGP feeds from more than 50 peers and refreshes the data periodically.
On Linux, install the whois client if needed.
Ubuntu or Debian:
sudo apt update
sudo apt install whoisThen query a real public address from your logs:
whois -h whois.cymru.com " -v <PUBLIC_IP>"The leading space before -v is intentional. It prevents some local whois clients from treating the option as their own.
The output structure looks similar to this:
AS | IP | BGP Prefix | CC | Registry | Allocated | AS Name
<ASN> | <IP> | <PREFIX> | XX | <RIR> | <DATE> | <NAME>You might extract only the important fields:
Origin ASN
BGP prefix
Registry
AS nameThat gives you a fast answer for incident investigation or troubleshooting.
Team Cymru’s documentation is available here: Team Cymru IP to ASN Mapping Service
Team Cymru also provides DNS-based ASN lookups.
This is useful when you need lightweight, cacheable queries.
For IPv4, reverse the octets of the address and query:
origin.asn.cymru.comSuppose the real address were:
A.B.C.DThe query would become:
dig +short D.C.B.A.origin.asn.cymru.com TXTThe returned structure is similar to:
"<ASN> | <PREFIX> | <CC> | <REGISTRY> | <ALLOCATED_DATE>"For example, if you are processing an address from a web log, your workflow can be:
Source IP
|
v
Reverse IPv4 octets
|
v
DNS TXT lookup
|
v
ASN + BGP prefixThe documentation address 198.51.100.25 would produce the query form:
dig +short 25.100.51.198.origin.asn.cymru.com TXTDo not expect a normal public routing result from documentation prefixes. They exist specifically for examples and should not represent ordinary globally routed customer networks.
For real investigation work, replace the address with the real public IP from your logs.
Team Cymru also supports IPv6 through its origin6.asn.cymru.com zone. IPv6 uses reversed hexadecimal nibbles rather than reversed IPv4 octets.
RIPEstat provides another useful source.
Its Network Info API accepts an IP address and returns:
The data comes from RIPE RIS routing observations.
You can query it with curl.
curl -s \
"https://stat.ripe.net/data/network-info/data.json?resource=<PUBLIC_IP>"If you have jq installed:
curl -s \
"https://stat.ripe.net/data/network-info/data.json?resource=<PUBLIC_IP>" \
| jq '.data | {prefix, asns}'Expected structure:
{
"prefix": "<MATCHING_PREFIX>",
"asns": [
<ORIGIN_ASN>
]
}This format is useful because it makes the relationship explicit:
IP
-> BGP prefix
-> origin ASNThe RIPEstat Network Info API documentation is available here: RIPEstat Network Info API
RDAP stands for Registration Data Access Protocol.
It is the modern standardized alternative to traditional WHOIS for accessing Internet resource registration information.
Unlike traditional WHOIS’s mostly free-form text responses, RDAP uses HTTP and JSON.
APNIC describes RDAP as providing standardized queries and responses, internationalization support, and registry redirection capabilities.
For APNIC-managed resources, the general request format is:
/ ip / <IP_ADDRESS>You can use curl and inspect the JSON response:
curl -s \
"https://rdap.apnic.net/ip/<PUBLIC_IP>" \
| jqFor an ASN:
curl -s \
"https://rdap.apnic.net/autnum/<ASN>" \
| jqThe specific RIR should normally be determined through RDAP’s bootstrap and referral mechanisms rather than assuming every address belongs to one registry.
ARIN likewise documents RDAP queries using forms such as:
<rdap-server>/ip/<IP>and:
<rdap-server>/autnum/<ASN>RDAP is valuable for finding information such as:
Registered network range
Network name
Resource holder
Registration status
RIR
Contact or abuse information
ASN registrationBut remember:
Registration does not automatically prove which ASN is currently originating the prefix in BGP.
Use routing data for that.
Traditional WHOIS remains useful, especially during quick investigations.
For APNIC space:
whois -h whois.apnic.net <PUBLIC_IP>An APNIC IP lookup can return the most specific registered network and related route objects.
APNIC documents command-line IP address searches and routing-related objects through its public WHOIS database.
After discovering an ASN, you can query it directly:
whois -h whois.apnic.net AS<ASN>An aut-num object can contain fields such as:
aut-num:
as-name:
descr:
country:
org:
admin-c:
tech-c:
abuse-c:
mnt-by:
source:APNIC notes that aut-num objects describe Autonomous Systems and can also assist network administrators when debugging network problems.
For one suspicious or interesting IP, I normally recommend separating the investigation into stages.
ipcalc <IP>or inspect the address manually.
If it belongs to private or special-purpose space, a public ASN lookup may not make sense.
Use Team Cymru:
whois -h whois.cymru.com " -v <PUBLIC_IP>"or RIPEstat:
curl -s \
"https://stat.ripe.net/data/network-info/data.json?resource=<PUBLIC_IP>" \
| jq '.data | {prefix, asns}'Do not save only:
ASN: ASxxxxxSave:
IP: <IP>
Prefix: <PREFIX>
Origin: AS<ASN>
Lookup at: <TIMESTAMP>The prefix is important when you later investigate routing changes.
Use RDAP or the appropriate RIR WHOIS service.
Now you can compare:
Routing view:
Origin ASN = ASxxxxx
Registration view:
Address holder = Organization A
ASN record:
ASxxxxx = Organization BSometimes A and B are the same.
Sometimes they are not.
If this information will affect:
check another independent source.
Do not build a production decision around one stale lookup response.
Not every IP address should have a public ASN.
The familiar private IPv4 ranges include:
10.0.0.0/8
172.16.0.0/12
192.168.0.0/16RFC 1918 defines these ranges for private internets. They are not meant to be globally routed as ordinary public Internet prefixes.
If your application log shows:
192.168.1.50an Internet ASN lookup will not tell you which ISP the end user belongs to.
You are looking at an internal address.
You need to find the public address after NAT, a reverse proxy, load balancer, VPN, or other network boundary.
For examples in documentation, use:
192.0.2.0/24
198.51.100.0/24
203.0.113.0/24These are reserved by RFC 5737.
The classic IPv6 documentation prefix is:
2001:db8::/32RFC 3849 reserved it for documentation examples.
IPv6 also has Unique Local Addresses under:
fc00::/7These are intended for local communications and are not expected to be routed on the global Internet.
ASN values also have special ranges.
For documentation examples, IANA reserves:
AS64496-AS64511
AS65536-AS65551Private-use ASN ranges include:
AS64512-AS65534
AS4200000000-AS4294967294RFC 6996 defines those private-use ranges and explains that private ASNs should not normally leak into the global Internet routing system.
That means this example is safe for documentation:
203.0.113.0/24 -> AS64496It should be understood as an illustration, not an assertion that a real organization owns or announces the prefix.
The basic concept is the same for IPv4 and IPv6.
IPv4 address
|
v
Most-specific IPv4 route
|
v
Origin ASNIPv6 address
|
v
Most-specific IPv6 route
|
v
Origin ASNThe address format changes.
The routing concept does not.
RIPEstat’s Network Info endpoint accepts IP addresses and can return the containing routed prefix and announcing ASN information. APNIC RDAP likewise supports IPv4 and IPv6 registration lookups.
Do not build an enrichment pipeline that assumes only IPv4.
A log schema should be able to handle both:
source_ip
ip_version
prefix
origin_asn
as_name
registry
lookup_timestampAn ASN lookup is not necessarily permanent.
Suppose today you obtain:
IP
|
v
Prefix A
|
v
AS XLater the same address may appear through:
IP
|
v
More-specific Prefix B
|
v
AS YSeveral things can cause this.
A network can change how it announces a prefix.
BGP uses prefix matching.
A more-specific route can change which announcement applies to a particular IP.
For example:
198.51.100.0/23 -> AS64496
198.51.100.0/24 -> AS64497An address inside the /24 follows the more-specific route when that route is visible and selected.
An organization may move:
Registration details can change when Internet number resources are transferred.
Routing events can temporarily produce different origin information.
Lookup systems observe, process, and publish routing data at different intervals.
For example, Team Cymru documents periodic refreshes of its BGP-derived mapping, while RIPEstat’s Network Info endpoint is based on RIPE RIS data.
A lookup result should therefore have a timestamp.
Sometimes one prefix is visible as being originated by more than one ASN.
This is commonly described as a multi-origin AS, or MOAS, situation.
You might see:
Prefix:
<NETWORK_PREFIX>
Observed origin ASNs:
ASxxxxx
ASyyyyyThat does not automatically mean the data is wrong.
It may result from legitimate multihoming, migrations, anycast architecture, routing policy, or other arrangements.
It can also indicate a routing configuration problem or, in some cases, an unexpected route announcement.
Team Cymru explicitly notes that its service can return multiple ASNs for the same address or prefix when it observes different announcements from its routing vantage points.
RIPEstat’s routing-history API can also show the history of prefix announcements and their origin ASNs using RIPE RIS data.
Do not force a MOAS result into a single ASN without understanding why multiple origins are visible.
Suppose Tool A says:
AS64500while Tool B says:
AS64501Do not immediately assume one tool is broken.
Work through the problem.
Ask:
When was each source updated?One service may be using newer BGP information.
Tool A may have matched:
198.51.100.0/23while Tool B sees a more-specific:
198.51.100.0/24The IP is the same.
The route view differs.
Query routing data that can expose multiple origin ASNs.
WHOIS may tell you:
Registered to Organization Awhile BGP data tells you:
Originated by Organization B's ASNThat is not necessarily a contradiction.
Use an independent BGP source when the answer affects an important operational decision.
A recent origin change may explain why different systems disagree.
The main rule is:
Do not validate an IP-to-ASN result using only another copy
of the same underlying database.Try to compare independent routing observations with authoritative registration data.
This deserves its own section.
If an IP lookup says:
Origin ASN: ASxxxxxyou have identified a network routing domain.
You have not identified a specific individual.
A single ASN may represent:
Even an individual public IP may represent many users behind NAT.
The relationship is closer to:
IP
-> routed network
-> ASN
-> network operatorIt is not:
IP
-> ASN
-> individual personAn ASN is useful network context.
It should not be treated as personal identity.
Another common mistake is treating an ASN lookup as a location lookup.
It is not.
ASN information answers:
Which network is routing this prefix?GeoIP tries to answer:
Where is this address probably being used?Those are different questions.
A multinational cloud provider may have one ASN announcing infrastructure across many countries.
A mobile operator may route users through infrastructure far from their physical location.
A public resolver may use anycast.
A VPN address may represent a user somewhere else entirely.
Team Cymru specifically warns that its registry country codes should not be treated as IP geolocation data.
This distinction also matters in DNS decision systems.
PinoyLinux discusses the difference between geographic location, network distance, and actual latency in Latency, Geography, And Network Distance: What DNS Can And Cannot Know.
An ASN lookup becomes useful when a problem appears to affect only certain networks.
Suppose users report:
Provider A -> Service works normally
Provider B -> High latency
Provider C -> Packet lossGrouping source addresses by ASN can expose a pattern.
Instead of looking at thousands of individual IPs:
IP 1
IP 2
IP 3
IP 4
IP 5
...you may discover:
Most affected addresses
|
v
Same ASNThat can shift your investigation toward:
It does not prove that the ASN caused the incident.
It gives you a useful dimension for investigation.
SOC teams can enrich security events with ASN data.
Instead of logging only:
{
"source_ip": "<PUBLIC_IP>"
}you could enrich the event:
{
"source_ip": "<PUBLIC_IP>",
"prefix": "<BGP_PREFIX>",
"origin_asn": "<ASN>",
"as_name": "<NETWORK_NAME>",
"registry": "<RIR>"
}Now analysts can ask:
How many alerts came from this ASN?
Are many addresses from the same hosting network scanning us?
Did a sudden attack involve one provider or many?
Are these IPs from residential networks or data-center networks?Be careful with automated blocking.
Blocking an ASN can affect far more users than blocking one address.
A major ISP, cloud provider, or CDN may contain a huge number of legitimate systems.
ASN data is excellent for enrichment and correlation.
It should not automatically become a block rule.
ASN enrichment is useful for:
A good enriched record might contain:
timestamp
source_ip
source_prefix
origin_asn
as_name
registry
country_if_separately_resolved
lookup_source
lookup_timestampNotice the final two fields:
lookup_source
lookup_timestampThey matter.
Because ASN mappings can change, you need to know where the value came from and when it was collected.
PinoyLinux previously discussed requester classification, where a network system turns signals such as an IP address, prefix, country, ASN, resolver information, or ECS into useful routing context.
Read that deeper discussion in Inside Requester Classification: IP, ASN, Country, And Resolver Signals.
This article handles one specific step inside that larger process:
Requester IP
|
v
Find prefix
|
v
Map prefix to origin ASN
|
v
ASN becomes classification dataThe ASN can then become one input among several.
For example:
Requester:
<IP>
Classification:
Country: PH
ASN: ASxxxxx
Prefix: <PREFIX>A policy engine could use that information later.
But the IP-to-ASN lookup itself should remain a clean, independently testable operation.
ASN-aware DNS steering uses the network identity behind a requester as one possible routing signal.
PinoyLinux’s DNS Steering 101: How Authoritative DNS Influences Traffic Direction explains the larger DNS decision process.
The practical relationship is simply:
DNS requester signal
|
v
IP or ECS prefix
|
v
IP-to-ASN lookup
|
v
Requester ASN
|
v
Routing policyFor example:
If ASN A:
Prefer endpoint X
If ASN B:
Prefer endpoint Y
Otherwise:
Use default policyThe article Weighted, Geo, ASN, And Failover Routing: Steering Techniques Compared explains where ASN-aware routing fits among other steering techniques.
The important point for this guide is that the quality of the routing decision depends partly on the quality of the IP-to-ASN mapping.
Bad or stale mapping can produce bad classification.
There is an extra complication with authoritative DNS.
The source IP seen by an authoritative DNS server is normally the recursive resolver.
That means an IP-to-ASN lookup may identify:
ASN of recursive resolverrather than:
ASN of actual end userThis distinction is important.
Example:
End user
|
v
Public recursive resolver
|
v
Authoritative DNSThe authoritative server may perform an ASN lookup on the resolver address.
That may identify the DNS provider’s ASN rather than the user’s ISP.
EDNS Client Subnet can sometimes provide part of the client network and improve this classification.
PinoyLinux covers the trade-offs in EDNS Client Subnet: Powerful Signal Or Operational Trap?.
ECS should still be treated as an optional network signal, not perfect knowledge.
This is why the IP-to-ASN lookup mechanism and the question “Which IP should I classify?” need to remain separate.
Sometimes your lookup returns no ASN.
Work through these checks.
Examples:
10.x.x.x
172.16.x.x through 172.31.x.x
192.168.x.xThese do not have normal global BGP origin ASNs.
Examples:
192.0.2.x
198.51.100.x
203.0.113.xThese are not ordinary public production addresses.
Check whether it is a global IPv6 address before expecting a normal public ASN result.
An address can be registered but not presently visible in global BGP.
Registration does not guarantee a live global route.
Try another BGP data source.
Reverse proxies and load balancers often make logs tricky.
Your application may have recorded:
proxy_ipinstead of:
client_ipCheck trusted proxy configuration before enriching the data.
If a service returns:
ASxxxxx
ASyyyyydo not discard one immediately.
Check:
Use routing history if necessary.
This is common enough that it should not surprise you.
You may have:
RDAP:
Prefix registered to Company A
BGP:
Prefix originated by AS belonging to Company BPossible reasons include:
Ask what you actually need to know.
If you need the resource holder:
Use RIR registration data.If you need the network currently announcing the route:
Use BGP origin data.If you need both:
Record both.Record:
IP
Prefix
ASN
Lookup source
Lookup timeThen compare another routing source.
Also check routing history.
If an ASN changed recently, both answers may have been correct at different times.
For operational systems, consider refreshing ASN data regularly rather than treating an IP-to-ASN mapping as permanent configuration.
If you are building your own tooling, avoid storing only:
IP -> ASNA better record is:
IP
|
+-- matched prefix
|
+-- origin ASN or ASNs
|
+-- ASN name
|
+-- RIR
|
+-- registration holder
|
+-- routing source
|
+-- lookup timestampThis gives you enough context to troubleshoot disagreements later.
For example:
{
"ip": "<PUBLIC_IP>",
"prefix": "<MATCHED_PREFIX>",
"origin_asns": [
"<ASN>"
],
"as_name": "<NAME>",
"registry": "<RIR>",
"lookup_source": "RIPE RIS",
"looked_up_at": "<TIMESTAMP>"
}If the prefix becomes multi-origin, the schema can already handle multiple ASNs.
Use these rules in production work:
These rules make ASN lookup useful without giving the data more authority than it deserves.
If you want to understand how ASN information becomes part of larger networking decisions, continue with these PinoyLinux articles.
Inside Requester Classification: IP, ASN, Country, And Resolver Signals
This explains how IP addresses, prefixes, ASN, country information, resolver signals, and ECS can become classification inputs.
DNS Steering 101: How Authoritative DNS Influences Traffic Direction
Read this if you need the larger context for how authoritative DNS can use network information when selecting answers.
EDNS Client Subnet: Powerful Signal Or Operational Trap?
This explains why the IP visible to authoritative DNS may represent a recursive resolver and how ECS can sometimes provide better client-network context.
Latency, Geography, And Network Distance: What DNS Can And Cannot Know
Useful when you need to understand why ASN, geographic location, network path, and latency are related but different signals.
Weighted, Geo, ASN, And Failover Routing: Steering Techniques Compared
This covers where ASN-aware routing fits alongside geographic, weighted, prefix-based, and failover policies.
Keeping DNS Answers Fast While Updating Routing Policy
Useful for understanding what happens when ASN mappings and routing policies become production inputs that need controlled updates.
An IP-to-ASN lookup maps an IP address through its routed network prefix to the Autonomous System announcing that prefix.
The basic relationship is:
IP address
|
v
Most-specific BGP prefix
|
v
Origin ASN
|
v
Network operatorAn ASN tells you about the network routing context behind an IP.
It does not identify a specific person.
WHOIS and RDAP provide registration information. BGP-derived services such as RIPE RIS and Team Cymru provide routing-origin information. Use the correct source for the question you are trying to answer.
Always keep the matched prefix and lookup timestamp alongside the ASN.
Expect changes.
A network can announce more-specific routes, migrate providers, become multi-origin, or change how address space is routed.
For sysadmins and SOC analysts, ASN enrichment can make logs and incidents easier to understand.
For network engineers, it can expose provider-specific routing patterns.
For DNS and CDN systems, it can become one input into requester classification and routing policy.
The lookup itself is simple.
Understanding what the result actually means is the important part.