LOCATION(1)

πŸ’… LOCATION(1) β€” the location page, but make it make sense

okay bestie, sit down, because this one is genuinely iconic. the manual name is location and it's a little command-line bestie for talking to the location database πŸ—ΊοΈβœ¨

✨ SYNOPSIS ✨

location export --directory=DIR [--format=FORMAT] [--family=ipv6|ipv4] [ASN|CC ...]
location get-as ASN [ASN...]
location list-countries [--show-name] [--show-continent]
location list-networks-by-as ASN
location list-networks-by-cc COUNTRY_CODE
location list-networks-by-flags [--anonymous-proxy|--satellite-provider|--anycast|--drop]
location lookup ADDRESS [ADDRESS...]
location search-as STRING
location update [--cron=daily|weekly|monthly]
location verify
location version

like, that's the whole vibe in one code block πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so location goes and retrieves information from the location database. that data is lowkey powerful: you can use it to figure out where someone is on the Internet 🌍, and you can use it to build firewall rulesets that block access from certain ASes or countries. main character firewall energy, no cap πŸ”₯


πŸŽ€ OPTIONS πŸŽ€

  • --database FILE, -d FILE β€” the path of the database which is being opened. if you omit this option, the system's database will be opened (default behaviour, slay 🫢).
  • --quiet β€” enable quiet mode 🀫
  • --debug β€” enable debugging mode πŸ›βœ¨

πŸ‘‘ COMMANDS πŸ‘‘

πŸ’– export [--directory=DIR] [--format=FORMAT] [--family=ipv6|ipv4] [ASN|CC ...]

this command exports the whole database into the given directory πŸ“¦

the output can be filtered by only exporting a certain address family, or by passing a list of country codes and/or ASNs. the default is to export all known countries 🌈

the output format can be chosen with the --format parameter. for possible formats, please see below πŸ‘‡

if the --directory option is omitted, the output will be written to stdout β€” which is literally so useful when you want to load any custom exports straight into nftables or ipset 😌

πŸ’– get-as ASN [ASN...]

this command returns the name of the owning organisation of the Autonomous System 🏒

πŸ’– list-countries [--show-name] [--show-continent]

lists all countries known to the database 🌎

with the optional parameters --show-name and --show-continent, the name and continent code will be printed, too ✨

πŸ’– list-networks-by-as [--family=[ipv6|ipv4]] [--format=FORMAT] ASN

lists all networks which belong to this Autonomous System πŸ•ΈοΈ

the --family parameter can be used to filter output to only IPv6 or IPv4 addresses.

the --format parameter can change the output so that it can be directly loaded into other software. for details see below πŸ‘€

πŸ’– list-networks-by-cc [--family=[ipv6|ipv4]] [--format=FORMAT] COUNTRY_CODE

lists all networks that belong to a country πŸ—Ύ

the country has to be encoded in ISO3166 Alpha-2 notation ⚠️ (so like, the two-letter code, not the whole name, bestie).

see above for usage of the --family and --format parameters.

πŸ’– list-networks-by-flags [--family=[ipv6|ipv4]] [--format=FORMAT] [--anonymous-proxy|--satellite-provider|--anycast|--drop]

lists all networks that have a certain flag 🚩

see above for usage of the --family and --format parameters.

πŸ’– list-bogons [--family=[ipv6|ipv4]] [--format=FORMAT]

lists all bogons (i.e. networks that are unknown to the database) πŸ’€

see above for usage of the --family and --format parameters.

πŸ’– lookup ADDRESS [ADDRESS...]

this command returns the network the given IP address has been found in as well as its Autonomous System if that information is available πŸ”

πŸ’– search-as STRING

lists all Autonomous Systems which match the given string πŸ”Ž

the search will be performed case-insensitively 😌 (so don't stress about caps, fr fr)

πŸ’– update

this command will try to update the local database πŸ”„

it will terminate with a return code of zero if the database has been successfully updated. 1 on error, 2 on invalid call and 3 if the database was already the latest version.

the --cron option allows limiting updates to once a day (daily), once a week (weekly), or once a month (monthly). if the task is being called, but the database has been updated recently, an update will be skipped ⏭️

πŸ’– verify

verifies the downloaded database βœ…

πŸ’– version

shows the version information of the downloaded database 🏷️

πŸ’– --help

shows a short help text on using this program πŸ†˜

πŸ’– --version

shows the program's version and exists πŸ‘‹ (yes, the page really says "exists" β€” copying it exactly, character for character, don't come for me)


🌈 EXIT CODES 🌈

the location command will normally exit with code zero πŸ˜‡ if there has been a problem and the requested action could not be performed, the exit code is unequal to zero 😭


πŸ“ FORMATS πŸ“

some commands allow specifying the output format. this is helpful if the exported data should be imported into a packet filter for example πŸ›‘οΈ the following formats are understood:

  • list (default): just lists all networks, one per line πŸ“
  • ipset: for ipset 🧺
  • nftables: for nftables πŸ”₯
  • xt_geoip: returns a list of networks to be loaded into the xt_geoip kernel module 🧠

🧚 HOW IT WORKS 🧚

the downloader checks a DNS record for the latest version of the database πŸ•΅οΈ then it will try to download a file with that version from a mirror server. if the downloaded file is outdated, the next mirror will be tried until we have found a file that is recent enough πŸ”βœ¨


πŸ™ˆ BUG REPORTS πŸ™ˆ

please report all bugs to the bugtracker at https://bugzilla.ipfire.org/; refer to https://wiki.ipfire.org/devel/bugzilla for details 🐞🫢


πŸ’œ AUTHORS πŸ’œ

Michael Tremer πŸ‘‘


ok that's the whole page, nothing skipped, every flag present and accounted for πŸ’…

and yeah β€” that's LOCATION(1) from the LOCATION manual, version... well, the footer just says LOCATION(1) again, so consider this your cute sign-off: page LOCATION(1), manual LOCATION(1), and the date on this footer is... also just the manual name, iconic of it honestly πŸ˜­πŸŽ€ go forth and block some ASes bestie πŸ’–

πŸ“¦ where this page comes from