---
id: "asn"
kind: "datatype"
status: "stable"
is_pii: false
categories: ["internet"]
langs: ["common"]
quality: 100
url: "http://registry.apicrafter.io/datatype/asn"
---

# Autonomous system number (ASN) (`asn`)

Number that identifies an autonomous system: a network or group of networks under one routing policy, such as an Internet service provider, a hosting company or a university, that exchanges routes with its neighbours over BGP. IANA hands out blocks of numbers to the five regional Internet registries, which assign them to network operators. Numbers were 16-bit (1 to 65535) until RFC 6793 extended them to 32 bits (up to 4294967295). They are written as a plain decimal number, often with the prefix AS (AS174). The regexp covers this asplain form, not the asdot form (1.10) of RFC 5396, and rejects AS 0, which is reserved (RFC 7607). RFC 5398 sets aside 64496-64511 and 65536-65551 for documentation.

- Personal data (PII): no
- Categories: Internet (internet)
- Countries: global
- Languages: Common to most languages (common)
- Classification: identifier

## Detection

Regular expression (Python `re`):

```
^(?:[Aa][Ss])?(?:429496729[0-5]|42949672[0-8][0-9]|4294967[01][0-9]{2}|429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|4294[0-8][0-9]{5}|429[0-3][0-9]{6}|42[0-8][0-9]{7}|4[01][0-9]{8}|[1-3][0-9]{9}|[1-9][0-9]{0,8})$
```

## Examples

- `174` — Cogent Communications (example of Wikidata property P3797)
- `2532` — Library of Congress (example of Wikidata property P3797)
- `AS64496` — First 16-bit ASN reserved for documentation (RFC 5398)
- `65551` — Last 32-bit ASN reserved for documentation (RFC 5398)
- `AS0` (invalid example) — AS 0 is reserved and never used in routing
- `4294967296` (invalid example) — Larger than a 32-bit number

## Mappings

- wikidata: `P3797`

## Metacrafter rules

4 rules: 1 match the field name, 3 match values.

- `asnbyfield` (field, `common/internet.yaml`)
- `asnbyprefixname` (data, `common/internet.yaml`)
- `asnbyvalue` (data, `common/internet.yaml`)
- `asnbyvalueandpostfix` (data, `common/internet.yaml`)

## Supported by tools

- `metacrafter`

## Translations

- ru: Номер автономной системы (ASN): Номер автономной системы в маршрутизации BGP: 16- или 32-битное число, часто с префиксом AS, например AS174.

## Sources

- wikipedia: <https://en.wikipedia.org/wiki/Autonomous_system_(Internet)>
- wikidata: <https://www.wikidata.org/wiki/Property:P3797>
- doc: <https://www.iana.org/assignments/as-numbers/as-numbers.xhtml>
- doc: <https://www.rfc-editor.org/rfc/rfc5398>

## Quality

Score 100/100.

JSON: <http://registry.apicrafter.io/api/v1/datatypes/asn.json> · Edit: <https://github.com/apicrafter/metacrafter-registry/edit/main/data/datatypes/any/internet/asn.yaml>
