1) Why do you do this?

This is my contribution to the cause. It might not be much but it is the thought that counts :)

2) How do the country mappings work?

ip2c.tcl queries the Regional Internet Registries and parses the results. A typical record would look something like this:


The ip2c script takes this entry, calculates the end address ( + 512) and puts it into the ip2c database along with the other info.

When we create mappings through the squert interface, we query the ip2c database and get the actual record for the IP(s) in question and put these in a new table called mappings. Duplicates are ignored. It is this table that is then used to do all country look-ups.

I choose to do it this way because the ip2c table contains a range; i.e. no indexes to leverage. If we were to join on this data, things would get pretty slow. By having a table with the 1->1 mappings we can quickly do joins on this table to produce a result. In fact, the join only adds about 0.2ms to the query.

This is my excuse anyway.

3) Why don't you just expand the entries with ip2c?

You would end up with very large (50GB maybe more) mappings table. Most of which you would never use.

4) Can I use / notation to query addresses?

No. But, you can do something like this:

10.%.%.%    =>
172.16.%.%  =>
192.168.0.% =>

or any combination thereof.

5) I get the error: "The used command is not allowed with this MySQL version" when I run ip2c.tcl, why?
The ip2c TCL scripts uses "LOAD DATA LOCAL INFILE" to dump the results into the database. 
While most stock MySQL installs are compiled with this, they don't always allow it.

Find the my.cnf that your client is using and add:


to the client section. If you just have the client installed and you cant find this
file just create it in /etc and add:

6) How can I change the interface timeout?
Log into mysql and run the following:
mysql> UPDATE sguildb.user_info SET timeout='<# of seconds>' WHERE username='<username>';