IP Location Database
The IP location database lets the Connection Monitor show where the remote ends of a device's connections are: country or region, optionally province and city, and the network operator (ASN). Bandix uses MaxMind GeoLite2 databases in .mmdb format. The database manager is part of the Connection Monitor Settings section on the Settings page.
Requirements
- Connection monitoring must be enabled and applied. The GeoIP functions are served by the backend's connection module. Without it, the manager shows "GeoIP service is unavailable. Enable connection monitoring and apply settings, or update Bandix."
- A backend version that implements the GeoIP API (
/api/geoip/statusand/api/geoip/manage). - Free storage in the database directory. Country databases are small; City databases with ASN data take considerably more space.
Database Directory
Database directory (bandix.connections.geoip_dir, default /usr/share/bandix-geoip) is where databases are stored. If your flash is small, point it at external storage. Save & Apply the directory before downloading: the manager uses the directory the running backend knows about.
The Manager
| Element | Function |
|---|---|
| Enable IP location lookup | Turns lookups on or off without deleting databases |
| Status badge | Enabled, Disabled (installed but off) or Not installed |
| Database contents | Country/region or Country/region + province/city, plus optional ASN / network organization |
| Download and enable / Update database | Downloads the selected contents; the label is Update database when the installed contents match the selection |
| Upload database | Imports a .mmdb file from your computer |
| Cancel | Stops a running download |
| Delete | Removes installed databases and disables lookups |
| Progress bar and message | Current operation and download progress |
| Database details | Installed databases, data source, release version, build dates, storage used, available space, directory |
The manager polls the backend's status every 2 seconds while the Settings page is open.
Database Profiles
The two content choices and the ASN checkbox map to four profiles sent to the backend:
| Selection | Profile |
|---|---|
| Country/region | country |
| Country/region + ASN | country_asn |
| Country/region + province/city | city |
| Country/region + province/city + ASN | city_asn |
When the selection differs from what is installed, the manager shows "Download contents: …" so you can see what a download would fetch.
Downloading
- Tick Enable Connection Monitoring and click Save & Apply (once).
- In IP location database, choose the contents.
- Click Download and enable.
The router downloads the files itself; the manager names the source as P3TERX / MaxMind GeoLite2 and links to that project's latest release and to MaxMind's GeoLite2 terms. The download goes through these phases:
| Phase | Message |
|---|---|
preparing |
Checking database version… |
checking_space |
Checking storage… |
downloading |
Downloading database… (with bytes and percentage) |
verifying |
Verifying database… |
activating |
Loading database… |
importing |
Importing database… |
completed |
Database ready |
up_to_date |
Database is up to date |
cancelled |
Download cancelled |
failed |
Database operation failed |
Cancel is available during all busy phases except activating.
Download Errors
| Message | Meaning |
|---|---|
| Cannot prepare storage. Check free space and directory permissions. | The space check failed |
| Not enough free space for this database. Required space: … · Available space: … | The directory's file system is too small |
| Database validation failed. The previous database is unchanged. | The downloaded file was not a valid database |
| Database operation failed. Retry or upload a local database. | Any other failure, for example no internet access |
| The installed database could not be loaded. Download or upload it again. | An installed file is corrupt |
Hover the message to see the backend's detailed error.
Uploading a Database
Use this when the router cannot reach GitHub, or when you have your own GeoLite2 copy:
- Click Upload database.
- Pick an uncompressed
.mmdbfile: a Country, City or ASN database. To add ASN data, install a Country or City database first. - Click Upload and enable.
The file is uploaded through LuCI's cgi-upload to /tmp/bandix-geoip-upload.mmdb (the ACL grants write access to exactly this path), and the backend is then told to import it. The maximum size is reported by the backend (upload_max_bytes); if it does not report one, the dialog uses 8 MiB. Files that do not end in .mmdb, are empty, or exceed the limit are refused with "Choose an uncompressed .mmdb file within the upload size limit."
Because the upload lands in /tmp (RAM) first, the router needs enough free memory for the file.
How Locations Are Displayed
For each address, the backend returns a scope. Public addresses show location and organization; others get a label:
scope |
Label |
|---|---|
local |
Local network |
private |
Private address |
loopback |
Loopback |
link_local |
Link-local address |
shared |
Shared address (CGNAT) |
multicast |
Multicast |
unspecified |
Unspecified address |
documentation |
Documentation address |
reserved |
Reserved address |
| anything else | Unknown location |
For public addresses, the cell shows country · region · city (duplicates removed) and the organization. The tooltip adds the ASN as AS<number>.
Country names are produced by the browser (Intl.DisplayNames) in the LuCI language when possible. Region and city names come from the database in the LuCI language; Chinese LuCI languages use the database's zh-CN names, and everything else falls back to English.
From the Shell
ubus call luci.bandix getGeoipStatus
ubus call luci.bandix manageGeoip '{"action":"download","profile":"country_asn"}'
ubus call luci.bandix manageGeoip '{"action":"enable","enabled":"1"}'
ubus call luci.bandix manageGeoip '{"action":"delete"}'
manageGeoip accepts only the actions download, enable, cancel, delete and import, and only the four profiles above, so it cannot be used to fetch arbitrary URLs. See RPC Methods.