]>
Commit | Line | Data |
---|---|---|
1d237439 | 1 | = location(8) |
161ac92d MT |
2 | |
3 | == NAME | |
1d237439 | 4 | location - Query the location database |
161ac92d MT |
5 | |
6 | == SYNOPSIS | |
7 | [verse] | |
7fc9b99b | 8 | `location export --directory=DIR [--format=FORMAT] [--family=ipv6|ipv4] [ASN|CC ...]` |
1d237439 | 9 | `location get-as ASN [ASN...]` |
2f42147f | 10 | `location list-countries [--show-name] [--show-continent]` |
1d237439 MT |
11 | `location list-networks-by-as ASN` |
12 | `location list-networks-by-cc COUNTRY_CODE` | |
e17e804e | 13 | `location list-networks-by-flags [--anonymous-proxy|--satellite-provider|--anycast|--drop]` |
2f42147f MT |
14 | `location lookup ADDRESS [ADDRESS...]` |
15 | `location search-as STRING` | |
97769987 | 16 | `location update [--cron=daily|weekly|monthly]` |
2f42147f | 17 | `location verify` |
f55a43e8 | 18 | `location version` |
161ac92d MT |
19 | |
20 | == DESCRIPTION | |
1d237439 | 21 | `location` retrieves information from the location database. |
161ac92d MT |
22 | This data can be used to determine someone's location on the Internet |
23 | and for building firewall rulesets to block access from certain ASes | |
24 | or countries. | |
25 | ||
26 | == OPTIONS | |
27 | ||
28 | --database FILE:: | |
29 | -d FILE:: | |
30 | The path of the database which is being opened. | |
31 | + | |
32 | If this option is omitted, the system's database will be opened. | |
33 | ||
e16d1683 MT |
34 | --quiet:: |
35 | Enable quiet mode | |
36 | ||
161ac92d MT |
37 | --debug:: |
38 | Enable debugging mode | |
39 | ||
40 | == COMMANDS | |
41 | ||
7fc9b99b MT |
42 | 'export --directory=DIR [--format=FORMAT] [--family=ipv6|ipv4] [ASN|CC ...]':: |
43 | This command exports the whole database into the given directory. | |
44 | + | |
45 | The output can be filtered by only exporting a certain address family, or by passing | |
46 | a list of country codes and/or ASNs. The default is to export all known countries. | |
47 | + | |
48 | The output format can be chosen with the '--format' parameter. For possible formats, | |
49 | please see below. | |
50 | ||
161ac92d MT |
51 | 'get-as ASN [ASN...]':: |
52 | This command returns the name of the owning organisation of the Autonomous | |
53 | System. | |
54 | ||
2f42147f MT |
55 | 'list-countries [--show-name] [--show-continent]':: |
56 | Lists all countries known to the database. | |
889b932a | 57 | + |
2f42147f MT |
58 | With the optional parameters '--show-name' and '--show-continent', the name and |
59 | continent code will be printed, too. | |
889b932a | 60 | |
96d6f071 | 61 | 'list-networks-by-as [--family=[ipv6|ipv4]] [--format=FORMAT] ASN':: |
161ac92d | 62 | Lists all networks which belong to this Autonomous System. |
4439e317 | 63 | + |
44e5ef71 MT |
64 | The '--family' parameter can be used to filter output to only IPv6 or |
65 | IPv4 addresses. | |
66 | + | |
96d6f071 MT |
67 | The '--format' parameter can change the output so that it can be |
68 | directly loaded into other software. For details see below. | |
161ac92d | 69 | |
96d6f071 | 70 | 'list-networks-by-cc [--family=[ipv6|ipv4]] [--format=FORMAT] COUNTRY_CODE':: |
161ac92d MT |
71 | Lists all networks that belong to a country. |
72 | + | |
73 | The country has to be encoded in ISO3166 Alpha-2 notation. | |
4439e317 | 74 | + |
96d6f071 | 75 | See above for usage of the '--family' and '--format' parameters. |
161ac92d | 76 | |
e17e804e | 77 | 'list-networks-by-flags [--family=[ipv6|ipv4]] [--format=FORMAT] [--anonymous-proxy|--satellite-provider|--anycast|--drop]':: |
bbdb2e0a MT |
78 | Lists all networks that have a certain flag. |
79 | + | |
96d6f071 | 80 | See above for usage of the '--family' and '--format' parameters. |
bbdb2e0a | 81 | |
8c37d8a7 MT |
82 | 'list-bogons [--family=[ipv6|ipv4]] [--format=FORMAT]':: |
83 | Lists all bogons (i.e. networks that are unknown to the database). | |
84 | + | |
85 | See above for usage of the '--family' and '--format' parameters. | |
86 | ||
2f42147f MT |
87 | 'lookup ADDRESS [ADDRESS...]':: |
88 | This command returns the network the given IP address has been found in | |
89 | as well as its Autonomous System if that information is available. | |
90 | ||
91 | 'search-as STRING':: | |
92 | Lists all Autonomous Systems which match the given string. | |
fa9a3663 | 93 | + |
2f42147f MT |
94 | The search will be performed case-insensitively. |
95 | ||
96 | 'update':: | |
97 | This command will try to update the local database. | |
98 | + | |
99 | It will terminate with a return code of zero if the database has been | |
100 | successfully updated. 1 on error, 2 on invalid call and 3 if the | |
101 | database was already the latest version. | |
97769987 MT |
102 | + |
103 | The '--cron' option allows limiting updates to once a day ('daily'), once a week | |
104 | ('weekly'), or once a month ('monthly'). If the task is being called, but the | |
105 | database has been updated recently, an update will be skipped. | |
2f42147f MT |
106 | |
107 | 'verify':: | |
108 | Verifies the downloaded database. | |
fa9a3663 | 109 | |
f55a43e8 PM |
110 | 'version':: |
111 | Shows the version information of the downloaded database. | |
112 | ||
161ac92d MT |
113 | '--help':: |
114 | Shows a short help text on using this program. | |
115 | ||
116 | '--version':: | |
117 | Shows the program's version and exists. | |
118 | ||
119 | == EXIT CODES | |
1d237439 | 120 | The 'location' command will normally exit with code zero. |
161ac92d MT |
121 | If there has been a problem and the requested action could not be performed, |
122 | the exit code is unequal to zero. | |
123 | ||
7fc9b99b MT |
124 | == FORMATS |
125 | Some commands allow specifying the output format. This is helpful if the exported | |
126 | data should be imported into a packet filter for example. | |
127 | The following formats are understood: | |
128 | ||
129 | * 'list' (default): Just lists all networks, one per line | |
130 | * 'ipset': For ipset | |
131 | * 'nftables': For nftables | |
132 | * 'xt_geoip': Returns a list of networks to be loaded into the | |
133 | xt_geoip kernel module | |
134 | ||
889b932a MT |
135 | == HOW IT WORKS |
136 | The downloader checks a DNS record for the latest version of the database. | |
137 | It will then try to download a file with that version from a mirror server. | |
138 | If the downloaded file is outdated, the next mirror will be tried until we | |
139 | have found a file that is recent enough. | |
140 | ||
f55a43e8 PM |
141 | == BUG REPORTS |
142 | Please report all bugs to the bugtracker at https://bugzilla.ipfire.org/; | |
143 | refer to https://wiki.ipfire.org/devel/bugzilla for details. | |
161ac92d MT |
144 | |
145 | == AUTHORS | |
146 | Michael Tremer |