Skip to main content

IP2Loc Country

Counts flow traffic by country, keyed by the two-letter country code that the IP2Location LITE database gives for the external IP of each flow.

PropertyValue
GUID{F962527D-985D-42FD-91D5-DA39F4D2A222}
LayerL3 Network
InputPackets, Flows
Key typeISO 3166 two-letter country code
ImplementationLua — cg_ip2loc_cc.lua (group), ip2location.lua (metering) (apps/analyzers/ip2location)
Trisul Appip2location (install from Trisul Apps)
Bucket / Topper60 s / 300 s
Enabled by defaultYes, after the app is installed

What it measures​

  • ip2location.lua runs as an sg_monitor script. It meters each flow when the probe flushes it to the hub, so it works for packet capture and for NetFlow/IPFIX/sFlow.
  • One IP is looked up per flow. If the Z side is in a home network, the A side is used. Otherwise the Z side is used.
  • IPv4 multicast and broadcast (keys E0. and above) are skipped. The database holds IPv4 ranges only, so IPv6 flows do not match.
  • The lookup uses the LevelDB file trisul-ip2loc-<engine>.level under //App/DataDirectory/plugins. You build it with installfeed.sh and your IP2Location download token. Without the database, nothing is metered.
  • Each flow updates one key, so there is no double counting.
  • Each key is also added as an edge vertex for the flow (add_flow_edges).

Keys​

One key is a country code from the CTRY table of the database. The compiler builds it from IP2LOCATION-LITE-DB1.CSV and IP2LOCATION-LITE-DB3.CSV. The label is the country name with all whitespace removed by the compiler. The label is set once per key with update_key_info.

KeyMeaning
USUnited States. Label UnitedStatesofAmerica
INIndia. Label India
DEGermany. Label Germany

Special keys​

KeyMeaning
SYS:GROUP_TOTALSSum of every update made to this group in the interval. It equals the traffic of all flows that matched a database range.
-IP2Location uses - for ranges with no country, such as private and reserved address space.

Meter list​

IDNameTypeUnitsTopBottomDescription
0TotalVT_RATE_COUNTERBps4040A→Z bytes plus Z→A bytes of the flow.
1Upload ToVT_RATE_COUNTERBps4040Bytes from the home side to the looked-up IP. When the Z side is not home, this is A→Z bytes.
2Download FromVT_RATE_COUNTERBps4040Bytes from the looked-up IP to the home side.
3FlowsVT_COUNTERflows40401 for each flushed flow that matched.
4uniqsVT_GAUGEUniques2020Reserved cardinality slot. Not populated.
5uniqsVT_GAUGEUniques2020Reserved cardinality slot. Not populated.