---
name: "xt_asn_build"
section: "1"
platform: "linux"
package: "xtables-addons-common"
version: "3.27-4"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/xt_asn_build"
---

# xt\_asn\_build(1)

convert ASN.csv to packed format for xt\_asn

## Name

xt\_asn\_build — convert ASN.csv to packed format for xt\_asn

## Syntax

*/usr/libexec/xt\_asn/***xt\_asn\_build** \[**-D** *target\_dir*\] \[**-S** *source\_dir*\] \[**-O** *output\_file*\]

## Description

xt\_asn\_build is used to build packed raw representations of the range database that the xt\_asn module relies on. Since kernel memory is precious, much of the preprocessing is done in userspace by this very building tool. One file is produced for each country, so that no more addresses than needed are required to be loaded into memory. The ranges in the packed database files are also ordered, as xt\_asn relies on this property for its bisection approach to work.

Since the script is usually installed to the libexec directory of the xtables-addons package and this is outside $PATH (on purpose), invoking the script requires it to be called with a path.

- **-D** *target\_dir*

  Specifies the target directory into which the files are to be put. Defaults to ".".

- **-S** *source\_dir*

  Specifies the source directory from which to read the two files by the name of **GeoLite2-ASN-Blocks-IPv?.csv**,

- **-O** *output\_file*

  Specifies an optioan target file to output DNS records for ASN to name (TXT-RRs) and network (APL-RRs).  Defaults to no output.  The file should be sorted postprocessing to remove duplicate TXT records and to combine APL-RRs into a more compact record set.

## Application

Shell commands to build the databases and put them to where they are expected:

xt\_asn\_build -D /usr/share/xt\_asn

## See also

[xt\_asn\_dl(1)](/xt_asn_dl/1.md)
