Update location attributes
To define policy based on geolocation, update the geolocation database with appropriate location and IP data.
When a request is received, a GeoLocator policy information point (PIP) determines the location of the device that made the request. The device IP address as determined by the point of contact server is the input to the PIP. The PIP reads the geolocation database to determine the device location.
All location attributes stored in the database are shown as environment attributes that used to author policies.
Location attributes include:
- Country
- State or region
- City
Sample data is included in the geolocation database. However, this sample data cannot be used in a production environment. Use the sample files for IPv4, IPv6, or both to create our own file. To locate the files, log in to the local management interface and click...
System > Secure Settings > File Downloads > access_control > cba > geolocation
Steps
- Obtain or create an appropriate geolocation data file in ZIP format.
The file or files we must use depend on whether we want support for IPv4 addresses, IPv6 addresses, or both. Both IPv4 and IPv6 files must be in the import ZIP, even if only one of the two data sets are going to be used.
IPv4
The file must contain two CSV files. One file contains all of the possible locations and the other contains the IP blocks and their corresponding locations.
- Locations file
- GeoIP (version 1 database)
- Each line in the locations file corresponds to one location and is in the following format:
location id,country,region,city,,,,,
We must include the 5 commas after citycommas in the locations file for version 1 data.
- GeoIP (version 2 database)
- Each line in the locations file corresponds to one location and is in the following format:
geoname id,,,,country iso code,,subdivision 1 iso code,,,,city name,,,
We must include the four commas separating the geoname id and country iso code, the two commas separating the country iso code and subdivision (region) iso code, the four commas separating the subdivision iso code and city name and the three commas after the city name in the location file for version 2 data.
- country
- A two-letter country code. For assistance with locating a country code, see geoCountryCode in Predefined attributes.
- region
- A two-character region code. For assistance with locating a region code, see geoRegionCode in Predefined attributes.
- city
- The name of a city.
The locations file must have Location in its file name. The sample provided is named: GeoLiteCity-Location.csv
- IP blocks file
- GeoIP (version 1 database)
- Each line in the IP blocks file corresponds to one IP block and is in the following format:
startip,endip,location id
- GeoIP (version 2 database)
- Each line in the IP block file corresponds to one IP block and is in the following format:
network (CIDR format),geoname_id,,,,,,latitude,longitude,
We must include the 6 commas after geoname_id and the trailing commas in the IPv4 log block files for version 2 data.
- startip
- The first IP address in the block that is represented as an integer.
- endip
- The last IP address in the block that is represented as an integer.
- location id
- The integer that is defined in the locations file that corresponds with the IP block.
The IP blocks file must have Blocks in its name. The sample provided is named: GeoLiteCity-Blocks.csv
Attention: Ensure the CSV files contain all of the data to load in the database. When importing te file, the existing data is removed and replaced with the data in the file.
IPv6
The file must contain one CSV file that contains all of the location and IP block information. Each line in the file corresponds to one location and IP block combination:
- GeoIP (version 1 database):
- Each line in the file corresponds to one location and IP block combination in the format:
startip string, endip string, startip int, endip int, country, region, city,,,,,
We must include the 5 commas after city in the IPv6 block file.
- GeoIP (version 2 database):
- Each line in the file corresponds to one location and IP block combination in the format:
network (CIDR format),geoname_id,,,,,,,,
We must include the 8 trailing commas after the geoname_id in the ipv6 blocks file. For GeoIP2 data the country, region and city attributes are read from the corresponding geoname_id in the locations file
- startip string
- The first IP address in the block that is represented as a hexadecimal string. For example, a IPv6 string might be 2001:200:ffff:ffff:ffff:ffff:ffff:ffff
- endip string
- The last IP address in the block that is represented as a hexadecimal string.
- startip integer
- The first IP address in the block that is represented as an integer. For example, the IPv6 integer corresponding to startip 2001:200:ffff:ffff:ffff:ffff:ffff:ffff might be 42540528806023212578155541913346768895.
- endip integer
- The last IP address in the block that is represented as an integer.
- country
- A two-letter country code. For assistance with locating a country code, see geoCountryCode in Predefined attributes.
- region
- A two-character region code. For assistance with locating a region code, see geoRegionCode in Predefined attributes.
- city
- The name of a city.
The file must have v6 in its file name. The sample provided is named: GeoLiteCityv6.csv
- Create a file in ZIP format containing the files we want to upload. For example, if to use both IPv4 and IPv6, include all the CSV files that we created in one ZIP formatted file.
- Log in to the local management interface.
- Click System.
- Under Updates and Licensing, click Geolocation Database.
- Click Import.
- Select the geolocation file in ZIP format.
- Click Import. Importing the data can take more than 20 minutes to complete.
- Click Refresh Status to check the import process. When the process is complete, the status says Loaded.
Parent topic: Attributes