IPWorks 3GPP AAA Server Geography Data Description

Contents

1Introduction
1.1Prerequisites
1.2Related Information

2

Concept

3

IPWorks AAA Server Geography Data
3.1Geography IP CSV File
3.2Anonymous Proxy CSV File

4

Appendix
4.1Tool to Import IPWorks AAA Server Geography Data
4.2Example Code

1   Introduction

This document describes IPWorks AAA Server Geography data. The data are contained in two Comma-Separated Values (CSV) files:

The CSV format follows the definition in RFC 4180 Common Format and MIME Type for CSV Files with the following restrictions:

IPWorks AAA Server does not provide Geography data. The customer can acquire data from third-party Geography data provider and translate the data as specific format defined in this document. Then, the Geography data is imported into the Internal Geography DB of IPWorks AAA Server.

Figure 1   Geography Data Processing

This document only describes the CSV files with IPWorks specific format.

1.1   Prerequisites

Not Applicable.

1.2   Related Information

Trademark information, typographic conventions, definition, and explanation of acronyms and terminology can be found in the following documents:

2   Concept

The Geography IP is the mapping from IP address to physical address of registrant in form of ISO 3166-1 alpha-2 Country Code.

The Anonymous proxy is a tool that attempts to make activity on the network untraceable. It is a proxy server computer that acts as an intermediary between a client device and the rest of the network. Anonymous proxy accesses the target network on behalf of user and hides the identifying information of the client computer, for example, the user IP address.

Figure 2   Anonymous Proxy in Network

3   IPWorks AAA Server Geography Data

3.1   Geography IP CSV File

Header line of Geography IP CSV File has two fields. The first field is subnet and the second field is iso_cc. The detail is defined in Table 1.

Table 1    Geography IP CSV File

Field Number

Field Name

Description

Example

1

subnet

All IPv4 addresses in a subnetwork belong to the same country.


It is written as the first address of a network, followed by a slash character (/), and ended with the bit-length of the prefix.


No network overlap is allowed for any 2 subnets.

1.0.1.0/24


The first IP is 1.0.1.0.


The last IP is 1.0.1.255.

2

iso_cc

Country Code in format of ISO 3166-1 alpha-2 standard.

CN

For example:

# cat ./aaageoipv4.csv

subnet,          iso_cc
1.0.0.0/24,      AU 
1.0.1.0/24,      CN
…

3.2   Anonymous Proxy CSV File

Header line of Anonymous Proxy CSV File has one field subnet. The detail is defined in Table 2.

Table 2    Anonymous Proxy Table

Field Name

Description

Example

subnet

All IP addresses in a subnetwork are anonymous proxies.


It is written as the first address of a network, followed by a slash character (/), and ended with the bit-length of the prefix.


No network overlap is allowed for any 2 subnets.

1.169.65.4/32


The first IP is 1.169.65.4.


The last IP is 1.169.65.4.

For example:

# cat ./ aaaanonproxyipv4.csv

subnet
1.9.21.21/32
1.169.65.4/32
…

4   Appendix

4.1   Tool to Import IPWorks AAA Server Geography Data

Usage: /opt/ipworks/IPWss/db/geoip/load_geoip_data.py -f <CSV_FILENAME> -t <AAA_DB_TABLENAME>

With:

CSV_FILENAME

The filename of IPWorks 3GPP AAA Geography data, for example, /tmp/aaageoipv4.csv

AAA_DB_TABLENAME

The table name must be aaageoipv4 for IPWorks AAA Server Geography IP data.


The table name must be aaaanonproxyipv4 for IPWorks AAA Server Anonymous Proxy data.

4.2   Example Code

4.2.1   Convert MaxMind GeoIP2 DB to IPWorks Specific Format

#!/usr/bin/python

import csv

output_ipworks_geoipv4_filename = "./aaageoipv4.csv"
input_maxmind_geoip_cc_filename= "./Geo-Country-Locations-en.csv"
input_maxmind_geoip_cb_filename= "./Geo-Country-Blocks-IPv4.csv"


file_out = open(output_ipworks_geoipv4_filename,"w")
dic_isocc={}

with open(input_maxmind_geoip_cc_filename) as fi_isocc:
	for each_isocc in csv.DictReader(fi_isocc):
		if each_isocc['geoname_id'] == "":
			raise csv.Error("The value of 'geoname_id' is empty, it's invalid")
		dic_isocc[each_isocc['geoname_id']] = each_isocc['country_iso_code']
	
file_out.write("subnet,iso_cc\n")

with open(input_maxmind_geoip_cb_filename) as fi_network:
	for each_network in csv.DictReader(fi_network):
		try:
			if each_network['geoname_id'] == "":continue
			file_out.write(each_network['network']+','+dic_isocc[each_network['geoname_id']]+'\n')
		except KeyError as e:
			raise csv.Error('Key: %s is not exist in file %s' % (e, input_maxmind_geoip_cc_filename))
file_out.close()

4.2.2   Convert MaxMind Anonymous IP DB to IPWorks Specific Format

#!/usr/bin/python

output_ipworks_anonproxy_filename = "./aaaanonproxyipv4.csv"
input_maxmind_anonproxy_filename= "./GeoIP2-Anonymous-IP-Blocks-IPv4.csv"

file_in = open(input_maxmind_anonproxy_filename)
file_out = open(output_ipworks_anonproxy_filename,"w")

file_out.write("subnet\n")
for each in file_in.readlines()[1:]:
    fields = map(str.strip, each.split(","))
    # field[0]:network 
    # field[1]:is_anonymous
    if (fields[1] == '1'):
        file_out.write(fields[0]+'\n')



Copyright

© Ericsson AB 2015-2017. All rights reserved. No part of this document may be reproduced in any form without the written permission of the copyright owner.

Disclaimer

The contents of this document are subject to revision without notice due to continued progress in methodology, design and manufacturing. Ericsson shall have no liability for any error or damage of any kind resulting from the use of this document.

Trademark List
All trademarks mentioned herein are the property of their respective owners. These are shown in the document Trademark Information.

    IPWorks 3GPP AAA Server Geography Data Description