Order of GeoIP processing: Difference between revisions

From VoIPmonitor.org
(Fix: Replace incorrect Dashboard content with correct GeoIP processing order documentation)
(Add MySQL GeoIP tables documentation with manual import procedure)
Line 31: Line 31:
| 2 || '''IPInfoDB API''' || Alternative commercial GeoIP API
| 2 || '''IPInfoDB API''' || Alternative commercial GeoIP API
|-
|-
| 3 || '''Local Database''' || Offline GeoIP database stored on the server
| 3 || '''Local Database''' || Offline GeoIP database stored on the server (file-based ''or'' MySQL tables)
|-
|-
| 4 || '''Free Portals''' || Fallback to free online GeoIP services
| 4 || '''Free Portals''' || Fallback to free online GeoIP services
Line 40: Line 40:
GeoIP services are configured in:
GeoIP services are configured in:
* '''GUI Path:''' Settings → System Configuration → GeoIP
* '''GUI Path:''' Settings → System Configuration → GeoIP
=== MySQL GeoIP Tables ===
In addition to file-based GeoIP databases (GeoIPCity.dat), VoIPmonitor can store GeoIP data in MySQL database tables:
* '''Table:''' <code>geoip_country</code> - IPv4 GeoIP data
* '''Table:''' '''geoipv6_country</code> - IPv6 GeoIP data
* '''Version tracking:''' The '''system''' table stores version numbers as:
  ** <code>type='geoip_country_version'</code>
  ** <code>type='geoipv6_country_version'</code>
The GUI's "Update GeoIP" function populates these tables from external sources. If the GUI update fails partially or incompletely, the version in the database may appear correct while actual data is missing.
==== Manual GeoIP Import ====
If the GUI's "Update GeoIP" function fails or completes partially, you can manually populate the GeoIP tables by importing data from a working installation.
'''Step 1: Export GeoIP tables from a working installation'''
On a server with a fresh or correctly populated VoIPmonitor database:
<syntaxhighlight lang="bash">
mysqldump -c voipmonitor geoip_country > gc.sql
mysqldump -c voipmonitor geoipv6_country > gc6.sql
</syntaxhighlight>
The <code>-c</code> flag ensures complete INSERT statements are included.
'''Step 2: Import the data to the affected server'''
Transfer the <code>gc.sql</code> and <code>gc6.sql</code> files to the affected server via SCP, SFTP, or another secure method.
Import the data into your VoIPmonitor database:
<syntaxhighlight lang="bash">
mysql voipmonitor < gc.sql
mysql voipmonitor < gc6.sql
</syntaxhighlight>
{{Warning|1=Ensure you are importing to the correct database name. Replace <code>voipmonitor</code> with your actual database name if different.}}
'''Step 3: Update version information in the system table'''
After importing, ensure the version tracking is updated to prevent GUI update prompts:
<syntaxhighlight lang="bash">
mysql voipmonitor
</syntaxhighlight>
<syntaxhighlight lang="sql">
-- Replace '12' with the actual version number
insert into voipmonitor.system set content='12\n',type='geoip_country_version';
insert into voipmonitor.system set content='12\n',type='geoipv6_country_version';
</syntaxhighlight>
The version number should match the GeoIP database version you imported (e.g., version 12 corresponds to GeoIP database version 12).
==== Troubleshooting MySQL GeoIP Tables ====
'''Problem: GUI shows correct version but GeoIP lookups fail'''
Symptom: The <code>system</code> table shows the correct version, but GeoIP resolution does not work or returns incomplete results.
Cause: The GUI update may have completed the version tracking without fully populating the data tables.
Solution: Use the manual import procedure above to fully populate the <code>geoip_country</code> and <code>geoipv6_country</code> tables.


{{Tip|1=For best accuracy and reliability, configure the MaxMind API with a valid license key.}}
{{Tip|1=For best accuracy and reliability, configure the MaxMind API with a valid license key.}}
Line 50: Line 116:
== AI Summary for RAG ==
== AI Summary for RAG ==


'''Summary:''' Documents the priority order for GeoIP processing in VoIPmonitor. The system uses a fallback mechanism: (1) MaxMind API (highest priority), (2) IPInfoDB API, (3) Local Database, (4) Free Portals (lowest priority). Each method is tried in sequence until a successful country lookup is achieved. Configuration is done via GUI Settings → System Configuration → GeoIP.
'''Summary:''' Documents the priority order for GeoIP processing in VoIPmonitor. The system uses a fallback mechanism: (1) MaxMind API (highest priority), (2) IPInfoDB API, (3) Local Database (file-based OR MySQL tables), (4) Free Portals (lowest priority). Each method is tried in sequence until a successful country lookup is achieved. Configuration is done via GUI Settings → System Configuration → GeoIP. MySQL tables: geoip_country (IPv4), geoipv6_country (IPv6) with version tracking in system table (type='geoip_country_version', type='geoipv6_country_version'). If GUI GeoIP update fails partially (version correct but data missing), manually import tables: mysqldump -c voipmonitor geoip_country > gc.sql from working installation, then mysql voipmonitor < gc.sql on affected server, update version in system table with insert into system set content='12\n',type='geoip_country_version'.


'''Keywords:''' GeoIP, MaxMind, IPInfoDB, country lookup, IP geolocation, processing order, priority, fallback, local database
'''Keywords:''' GeoIP, MaxMind, IPInfoDB, country lookup, IP geolocation, processing order, priority, fallback, local database, MySQL tables, geoip_country, geoipv6_country, manual import, system table, geoip_country_version, geoipv6_country_version


'''Key Questions:'''
'''Key Questions:'''
Line 60: Line 126:
* What happens if MaxMind API fails?
* What happens if MaxMind API fails?
* Does VoIPmonitor support local GeoIP database?
* Does VoIPmonitor support local GeoIP database?
* How to manually import GeoIP data from a working installation?
* What are the MySQL tables for GeoIP data?
* GUI GeoIP update fails partially - how to fix?

Revision as of 20:21, 6 January 2026


Order of GeoIP Processing

This page documents the priority order in which VoIPmonitor processes GeoIP lookups to determine geographic location of IP addresses.

Processing Priority

VoIPmonitor uses a fallback mechanism for GeoIP lookups. The system attempts each method in order until a successful result is obtained:

Priority Method Description
1 MaxMind API Commercial GeoIP service with high accuracy
2 IPInfoDB API Alternative commercial GeoIP API
3 Local Database Offline GeoIP database stored on the server (file-based or MySQL tables)
4 Free Portals Fallback to free online GeoIP services

Configuration

GeoIP services are configured in:

  • GUI Path: Settings → System Configuration → GeoIP

MySQL GeoIP Tables

In addition to file-based GeoIP databases (GeoIPCity.dat), VoIPmonitor can store GeoIP data in MySQL database tables:

  • Table: geoip_country - IPv4 GeoIP data
  • Table: geoipv6_country - IPv6 GeoIP data
  • Version tracking: The system table stores version numbers as:
 ** type='geoip_country_version'
 ** type='geoipv6_country_version'

The GUI's "Update GeoIP" function populates these tables from external sources. If the GUI update fails partially or incompletely, the version in the database may appear correct while actual data is missing.

Manual GeoIP Import

If the GUI's "Update GeoIP" function fails or completes partially, you can manually populate the GeoIP tables by importing data from a working installation.

Step 1: Export GeoIP tables from a working installation

On a server with a fresh or correctly populated VoIPmonitor database:

mysqldump -c voipmonitor geoip_country > gc.sql
mysqldump -c voipmonitor geoipv6_country > gc6.sql

The -c flag ensures complete INSERT statements are included.

Step 2: Import the data to the affected server

Transfer the gc.sql and gc6.sql files to the affected server via SCP, SFTP, or another secure method.

Import the data into your VoIPmonitor database:

mysql voipmonitor < gc.sql
mysql voipmonitor < gc6.sql

⚠️ Warning: Ensure you are importing to the correct database name. Replace voipmonitor with your actual database name if different.

Step 3: Update version information in the system table

After importing, ensure the version tracking is updated to prevent GUI update prompts:

mysql voipmonitor
-- Replace '12' with the actual version number
insert into voipmonitor.system set content='12\n',type='geoip_country_version';
insert into voipmonitor.system set content='12\n',type='geoipv6_country_version';

The version number should match the GeoIP database version you imported (e.g., version 12 corresponds to GeoIP database version 12).

Troubleshooting MySQL GeoIP Tables

Problem: GUI shows correct version but GeoIP lookups fail

Symptom: The system table shows the correct version, but GeoIP resolution does not work or returns incomplete results.

Cause: The GUI update may have completed the version tracking without fully populating the data tables.

Solution: Use the manual import procedure above to fully populate the geoip_country and geoipv6_country tables.

💡 Tip: For best accuracy and reliability, configure the MaxMind API with a valid license key.

Related Pages

AI Summary for RAG

Summary: Documents the priority order for GeoIP processing in VoIPmonitor. The system uses a fallback mechanism: (1) MaxMind API (highest priority), (2) IPInfoDB API, (3) Local Database (file-based OR MySQL tables), (4) Free Portals (lowest priority). Each method is tried in sequence until a successful country lookup is achieved. Configuration is done via GUI Settings → System Configuration → GeoIP. MySQL tables: geoip_country (IPv4), geoipv6_country (IPv6) with version tracking in system table (type='geoip_country_version', type='geoipv6_country_version'). If GUI GeoIP update fails partially (version correct but data missing), manually import tables: mysqldump -c voipmonitor geoip_country > gc.sql from working installation, then mysql voipmonitor < gc.sql on affected server, update version in system table with insert into system set content='12\n',type='geoip_country_version'.

Keywords: GeoIP, MaxMind, IPInfoDB, country lookup, IP geolocation, processing order, priority, fallback, local database, MySQL tables, geoip_country, geoipv6_country, manual import, system table, geoip_country_version, geoipv6_country_version

Key Questions:

  • What is the order of GeoIP processing in VoIPmonitor?
  • Which GeoIP service has highest priority?
  • Where do I configure GeoIP services in VoIPmonitor?
  • What happens if MaxMind API fails?
  • Does VoIPmonitor support local GeoIP database?
  • How to manually import GeoIP data from a working installation?
  • What are the MySQL tables for GeoIP data?
  • GUI GeoIP update fails partially - how to fix?