|
|
|
|
Location-Based Load Balancing (IPDB/LGRP)
Figure 1: Network Setup Overview This example is similar to example 5, but introduces the following new key concepts available with BalanceNG 2.160 and higher:
New Concepts and Configuration Directives First of all it's needed to load a IP-to-Location database file into memory. This is done with the "ipdb" command loading the file from the default location: ipdb "/opt/BalanceNG/ip-to-country.csv" BalanceNG supports the following two different .csv database file formats (without any warranty and under the licensing terms of the original maintainers):
Then, two "location groups" are defined: Group A containing the coutries Germany, Austria and Switzerland and Group B containing everything else (including client IP addresses which are not found in the database). This is done by including the following lines in the BalanceNG configuration:
The server section needs to have "ipdb enable" included to enable the IPDB lookup mechanism like this:
Please note that the ipdb lgrp feature does not work with the server methods "rr" (round-robin) and "hash". As a final step the targets need to be associated with the "location groups" defined earlier in the configuration file. This is done by including the directive "lgrp" in the target section. In this example target 1 and two are member of lgrp A, and target 3 and 4 are member of lgrp B:
Informational Commands The command "show ipdb" displays information about the currently loaded IP-to-location database: NodeA# show ipdb IPDB loaded from /opt/BalanceNG/ip-to-country.csv 83429 valid 5-column lines 83429 total IPDB entries available no consecutive area overlaps 235 different IPDB locations referenced NodeA# Another interesting feature is the ability to "locate" any IPv4 address using the locate command like this:
NodeA# locate 82.135.110.2 address 82.135.110.2 is in DE (GERMANY) NodeA# The command "show locations" displays an overview of the current known locations in the IPDB database. Additionally, there's a session counter maintained for each location (example output truncated): NodeA# sh locations key counter description --- -------- ------------------------------------ AD ANDORRA AE 2 UNITED ARAB EMIRATES AF AFGHANISTAN ... CN 44 CHINA CO 9 COLOMBIA CR COSTA RICA CS 4 SERBIA AND MONTENEGRO CU CUBA CV CAPE VERDE CY 2 CYPRUS CZ 9 CZECH REPUBLIC DE 596 GERMANY DJ DJIBOUTI DK 23 DENMARK DM DOMINICA DO 8 DOMINICAN REPUBLIC ... UM UNITED STATES MINOR OUTLYING ISLANDS US 708 UNITED STATES UY 3 URUGUAY UZ 1 UZBEKISTAN VA HOLY SEE (VATICAN CITY STATE) VC SAINT VINCENT AND THE GRENADINES VE 8 VENEZUELA VG VIRGIN ISLANDS, BRITISH VI VIRGIN ISLANDS, U.S. VN 23 VIET NAM VU VANUATU WF WALLIS AND FUTUNA WS SAMOA YE YEMEN YT MAYOTTE ZA SOUTH AFRICA ZM ZAMBIA ZW ZIMBABWE - 30 *** NOT FOUND PSEUDO ENTRY *** --- -------- ------------------------------------ 235 2940 total Some descriptions appear to be empty in the database from WebHosting.info (which is accepted by BalanceNG). The command "clear locationcounters" resets all these counters back to 0. Configuration Files The configuration files in this example are complete and are meant to be a reference ready for production use. This example requires licensing to enable VRRP. Please contact us for test licenses.
Please contact us in case of any questions, errors or suggestions at info@inlab.de. |
|
|
| Copyright © 1991-2011,2012 by Inlab Software GmbH, All Rights Reserved - Impressum - Widerrufsrecht - Sitemap - Internal |