| 1 | <!--startmeta |
| 2 | custom_edit_url: "https://github.com/netdata/netdata/edit/master/src/crates/netflow-plugin/integrations/caida_routeviews_prefix-to-as.md" |
| 3 | meta_yaml: "https://github.com/netdata/netdata/edit/master/src/crates/netflow-plugin/metadata.yaml" |
| 4 | sidebar_label: "CAIDA Routeviews Prefix-to-AS" |
| 5 | learn_status: "Published" |
| 6 | learn_rel_path: "Network Flows/Enrichment Methods" |
| 7 | keywords: ['caida', 'routeviews', 'prefix2as', 'pfx2as', 'asn', 'bgp', 'ip intelligence', 'flow enrichment'] |
| 8 | message: "DO NOT EDIT THIS FILE DIRECTLY, IT IS GENERATED BY THE FLOWS' metadata.yaml FILE" |
| 9 | endmeta--> |
| 10 | |
| 11 | <!-- markdownlint-disable-file --> |
| 12 | |
| 13 | # CAIDA Routeviews Prefix-to-AS |
| 14 | |
| 15 | |
| 16 | <img src="https://netdata.cloud/img/network-wired.svg" width="150"/> |
| 17 | |
| 18 | |
| 19 | Plugin: netflow-plugin |
| 20 | Module: caida-prefix2as |
| 21 | |
| 22 | <img src="https://img.shields.io/badge/maintained%20by-Netdata-%2300ab44" /> |
| 23 | |
| 24 | ## Overview |
| 25 | |
| 26 | Enrich network flows with AS numbers from CAIDA's Routeviews Prefix-to-AS |
| 27 | mapping dataset. CAIDA derives this public dataset from RouteViews BGP data and |
| 28 | publishes one prefix-to-origin-AS mapping per line. The official format is |
| 29 | tab-separated `IP prefix`, `prefix length`, and `AS number`; multi-origin AS |
| 30 | entries can contain multiple ASNs, and the Netdata downloader keeps the first |
| 31 | listed origin AS as the simplified per-prefix value. |
| 32 | |
| 33 | CAIDA Prefix-to-AS is ASN-only. It does not provide AS organization names or |
| 34 | geographic fields. Pair it with DB-IP, MaxMind, IP2Location, IPDeny, IPIP, or |
| 35 | another geo provider when you also need `*_COUNTRY`, city, state, or |
| 36 | coordinates. |
| 37 | |
| 38 | For the IP-intelligence mechanism (lookup order, MMDB composition, refresh, |
| 39 | provider chains), see |
| 40 | [IP Intelligence](https://learn.netdata.cloud/docs/network-flows/enrichment). |
| 41 | |
| 42 | |
| 43 | The netflow plugin reads MMDB files only. CAIDA publishes compressed text data, |
| 44 | so use Netdata's `topology-ip-intel-downloader` to fetch the latest Routeviews |
| 45 | Prefix-to-AS file, convert it to `topology-ip-asn.mmdb`, and place it in the |
| 46 | standard auto-detected cache directory. The plugin reloads the generated MMDB |
| 47 | automatically when the file changes. |
| 48 | |
| 49 | |
| 50 | This integration is only supported on the following platforms: |
| 51 | |
| 52 | - Linux |
| 53 | |
| 54 | This integration runs as a single instance per Netdata Agent. |
| 55 | |
| 56 | |
| 57 | ### Default Behavior |
| 58 | |
| 59 | #### Auto-Detection |
| 60 | |
| 61 | Not used by the default install. After the downloader writes `topology-ip-asn.mmdb` into the standard cache path, the plugin auto-detects the generated file. |
| 62 | |
| 63 | #### Limits |
| 64 | |
| 65 | ASN number only. No AS organization name, country, state, city, or coordinates are available from this source. |
| 66 | |
| 67 | #### Performance Impact |
| 68 | |
| 69 | Lookups are local MMDB reads after conversion. Memory use is mostly the mapped database file and the kernel page cache needed to keep active pages hot. |
| 70 | |
| 71 | ## Setup |
| 72 | |
| 73 | |
| 74 | ### Prerequisites |
| 75 | |
| 76 | #### Downloader with CAIDA Prefix-to-AS support |
| 77 | |
| 78 | Run the bundled downloader when available. Packaged 32-bit installs do not |
| 79 | include this binary: |
| 80 | |
| 81 | ```bash |
| 82 | sudo /usr/sbin/topology-ip-intel-downloader \ |
| 83 | --asn caida:prefix2as \ |
| 84 | --geo dbip:city-lite |
| 85 | ``` |
| 86 | |
| 87 | `caida:prefix2as` is valid only for `--asn`. The example keeps DB-IP |
| 88 | city-lite for geo fields; substitute any supported `--geo` provider if |
| 89 | country-only enrichment is sufficient. |
| 90 | |
| 91 | |
| 92 | #### CAIDA acceptable use terms |
| 93 | |
| 94 | CAIDA documents acceptable-use and attribution requirements on the dataset |
| 95 | page. Review the terms before redistributing generated datasets or derived |
| 96 | reports. |
| 97 | |
| 98 | |
| 99 | |
| 100 | ### Configuration |
| 101 | |
| 102 | #### Options |
| 103 | |
| 104 | Once the downloader has produced a CAIDA-derived ASN MMDB in the cache |
| 105 | directory, the plugin auto-detects it. To pin paths explicitly, set |
| 106 | `enrichment.geoip.asn_database` and keep `geo_database` pointed at your chosen |
| 107 | geographic provider. |
| 108 | |
| 109 | |
| 110 | <details open><summary>Config options</summary> |
| 111 | |
| 112 | |
| 113 | |
| 114 | | Option | Description | Default | Required | |
| 115 | |:-----|:------------|:--------|:---------:| |
| 116 | | enrichment.geoip.asn_database | Path to the CAIDA-derived ASN MMDB. Empty = auto-detect from the cache directory. | [] | no | |
| 117 | | enrichment.geoip.geo_database | Optional geographic MMDB paths supplied by another provider. | [] | no | |
| 118 | | enrichment.geoip.optional | When true, missing or unreadable MMDBs are warnings, not fatal at startup. | false (true when auto-detected) | no | |
| 119 | |
| 120 | |
| 121 | </details> |
| 122 | |
| 123 | |
| 124 | |
| 125 | #### via File |
| 126 | |
| 127 | The configuration file name for this integration is `netflow.yaml`. |
| 128 | |
| 129 | |
| 130 | You can edit the configuration file using the [`edit-config`](https://github.com/netdata/netdata/blob/master/docs/netdata-agent/configuration/README.md#edit-configuration-files) script from the |
| 131 | Netdata [config directory](https://github.com/netdata/netdata/blob/master/docs/netdata-agent/configuration/README.md#locate-your-config-directory). |
| 132 | |
| 133 | ```bash |
| 134 | cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata |
| 135 | sudo ./edit-config netflow.yaml |
| 136 | ``` |
| 137 | |
| 138 | ##### Examples |
| 139 | |
| 140 | ###### After running the downloader with CAIDA ASN and DB-IP geo |
| 141 | |
| 142 | Auto-detection picks up both generated cache files. |
| 143 | |
| 144 | ```yaml |
| 145 | enrichment: |
| 146 | geoip: |
| 147 | asn_database: [] |
| 148 | geo_database: [] |
| 149 | optional: true |
| 150 | |
| 151 | ``` |
| 152 | ###### Explicit CAIDA ASN path |
| 153 | |
| 154 | Pin CAIDA for AS numbers and keep a separate geo source for country/city fields. |
| 155 | |
| 156 | <details open><summary>Config</summary> |
| 157 | |
| 158 | ```yaml |
| 159 | enrichment: |
| 160 | geoip: |
| 161 | asn_database: |
| 162 | - /var/cache/netdata/topology-ip-intel/topology-ip-asn.mmdb |
| 163 | geo_database: |
| 164 | - /var/cache/netdata/topology-ip-intel/topology-ip-geo.mmdb |
| 165 | optional: false |
| 166 | |
| 167 | ``` |
| 168 | </details> |
| 169 | |
| 170 | |
| 171 | |
| 172 | ### AS names are empty |
| 173 | |
| 174 | CAIDA Prefix-to-AS contains AS numbers, not organization names. Layer a |
| 175 | provider with AS organization data, such as MaxMind GeoLite2 ASN or DB-IP |
| 176 | ASN Lite, after the CAIDA MMDB in `asn_database` if AS names matter. |
| 177 | |
| 178 | |
| 179 | ### Country fields are empty |
| 180 | |
| 181 | This source is ASN-only. Configure a `--geo` provider in the downloader or |
| 182 | point `enrichment.geoip.geo_database` at a separate geo MMDB. |
| 183 | |
| 184 | |
| 185 | ### Multi-origin AS simplification |
| 186 | |
| 187 | CAIDA can represent multi-origin prefixes. The downloader uses the first |
| 188 | listed AS for the generated single-value MMDB record. If you need full MOAS |
| 189 | semantics, use BMP or BioRIS routing enrichment instead of an offline ASN |
| 190 | lookup database. |
| 191 | |
| 192 | |
| 193 |