]>
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` | |
13 | `location list-networks-by-flags [--anonymous-proxy|--satellite-provider|--anycast]` | |
2f42147f MT |
14 | `location lookup ADDRESS [ADDRESS...]` |
15 | `location search-as STRING` | |
16 | `location update` | |
17 | `location verify` | |
161ac92d MT |
18 | |
19 | == DESCRIPTION | |
1d237439 | 20 | `location` retrieves information from the location database. |
161ac92d MT |
21 | This data can be used to determine someone's location on the Internet |
22 | and for building firewall rulesets to block access from certain ASes | |
23 | or countries. | |
24 | ||
25 | == OPTIONS | |
26 | ||
27 | --database FILE:: | |
28 | -d FILE:: | |
29 | The path of the database which is being opened. | |
30 | + | |
31 | If this option is omitted, the system's database will be opened. | |
32 | ||
e16d1683 MT |
33 | --quiet:: |
34 | Enable quiet mode | |
35 | ||
161ac92d MT |
36 | --debug:: |
37 | Enable debugging mode | |
38 | ||
39 | == COMMANDS | |
40 | ||
7fc9b99b MT |
41 | 'export --directory=DIR [--format=FORMAT] [--family=ipv6|ipv4] [ASN|CC ...]':: |
42 | This command exports the whole database into the given directory. | |
43 | + | |
44 | The output can be filtered by only exporting a certain address family, or by passing | |
45 | a list of country codes and/or ASNs. The default is to export all known countries. | |
46 | + | |
47 | The output format can be chosen with the '--format' parameter. For possible formats, | |
48 | please see below. | |
49 | ||
161ac92d MT |
50 | 'get-as ASN [ASN...]':: |
51 | This command returns the name of the owning organisation of the Autonomous | |
52 | System. | |
53 | ||
2f42147f MT |
54 | 'list-countries [--show-name] [--show-continent]':: |
55 | Lists all countries known to the database. | |
889b932a | 56 | + |
2f42147f MT |
57 | With the optional parameters '--show-name' and '--show-continent', the name and |
58 | continent code will be printed, too. | |
889b932a | 59 | |
44e5ef71 | 60 | 'list-networks-by-as [--family=[ipv6|ipv4]] [--output-format FORMAT] ASN':: |
161ac92d | 61 | Lists all networks which belong to this Autonomous System. |
4439e317 | 62 | + |
44e5ef71 MT |
63 | The '--family' parameter can be used to filter output to only IPv6 or |
64 | IPv4 addresses. | |
65 | + | |
4439e317 MT |
66 | The '--output-format' parameter can change the output so that it can be |
67 | directly loaded into other software. The following options are available: | |
68 | + | |
69 | * 'list' (default): Just lists all networks, one per line | |
6da14cc1 | 70 | * 'ipset': For ipset |
71e0ad0b | 71 | * 'nftables': For nftables |
4439e317 MT |
72 | * 'xt_geoip': Returns a list of networks to be loaded into the xt_geoip |
73 | kernel module | |
161ac92d | 74 | |
44e5ef71 | 75 | 'list-networks-by-cc [--family=[ipv6|ipv4]] [--output-format FORMAT] COUNTRY_CODE':: |
161ac92d MT |
76 | Lists all networks that belong to a country. |
77 | + | |
78 | The country has to be encoded in ISO3166 Alpha-2 notation. | |
4439e317 | 79 | + |
44e5ef71 | 80 | See above for usage of the '--family' and '--output-format' parameters. |
161ac92d | 81 | |
44e5ef71 | 82 | 'list-networks-by-flags [--family=[ipv6|ipv4]] [--output-format FORMAT] [--anonymous-proxy|--satellite-provider|--anycast]':: |
bbdb2e0a MT |
83 | Lists all networks that have a certain flag. |
84 | + | |
44e5ef71 | 85 | See above for usage of the '--family' and '--output-format' parameters. |
bbdb2e0a | 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. | |
102 | ||
103 | 'verify':: | |
104 | Verifies the downloaded database. | |
fa9a3663 | 105 | |
161ac92d MT |
106 | '--help':: |
107 | Shows a short help text on using this program. | |
108 | ||
109 | '--version':: | |
110 | Shows the program's version and exists. | |
111 | ||
112 | == EXIT CODES | |
1d237439 | 113 | The 'location' command will normally exit with code zero. |
161ac92d MT |
114 | If there has been a problem and the requested action could not be performed, |
115 | the exit code is unequal to zero. | |
116 | ||
7fc9b99b MT |
117 | == FORMATS |
118 | Some commands allow specifying the output format. This is helpful if the exported | |
119 | data should be imported into a packet filter for example. | |
120 | The following formats are understood: | |
121 | ||
122 | * 'list' (default): Just lists all networks, one per line | |
123 | * 'ipset': For ipset | |
124 | * 'nftables': For nftables | |
125 | * 'xt_geoip': Returns a list of networks to be loaded into the | |
126 | xt_geoip kernel module | |
127 | ||
889b932a MT |
128 | == HOW IT WORKS |
129 | The downloader checks a DNS record for the latest version of the database. | |
130 | It will then try to download a file with that version from a mirror server. | |
131 | If the downloaded file is outdated, the next mirror will be tried until we | |
132 | have found a file that is recent enough. | |
133 | ||
161ac92d MT |
134 | == BUGS |
135 | Please report all bugs to the bugtracker at https://bugzilla.ipfire.org/. | |
136 | ||
137 | == AUTHORS | |
138 | Michael Tremer |