Category Archives: Network

利用纯真IP库建立mysql ip数据库

首先到http://www.cz88.net/ 下载一个最新的ip库,安装ip库后会生成一个快捷方式,如下图所示:

点击打开后,出现下图界面:

点击解压,会生成一个20多兆的文本文件,打开或者下载一个UltraEdit打开,另存为utf-8的文本文档,这样可以防止出现乱码。在此之前我们要修改一下php.ini的配置,不然中途可能会出现一些错误
默认情况下:MySQL导入文件大小有限制的,最大为2M,所以当文件很大时候,直接无法导入,下面就这个问题的解决列举如下:
在php.ini中修改相关参数:
影响MySQL导入文件大小的参数有三个:
memory_limit=128M,upload_max_filesize=2M,post_max_size=8M
我比较懒,直接将这三个都改成了128。
首先创建数据库

  1. CREATE TABLE ip_data (
  2. ipstart INT UNSIGNED NOT NULL,
  3. ipend INT UNSIGNED NOT NULL,
  4. region VARCHAR(50) NOT NULL,
  5. address VARCHAR(100) NOT NULL,
  6. PRIMARY KEY (ipstart, ipend)
  7. ) TYPE = MyISAM;

首先在PhpMyAdmin里手动建一个名称为ip_data的数据库,然后插入上面的sql语句,一个名称为ip_data的表单就可以建好了
接着将下面的代码

  1. <?php
  2. function EncodeIp($strDotquadIp) { // 把点格式的ip地址转换成整数表示的ip地址
  3. $arrIpSep = explode(‘.’, $strDotquadIp);
  4. if (count($arrIpSep) != 4) return 0;
  5. $intIp = 0;
  6. foreach ($arrIpSep as $k => $v) $intIp += (int)$v * pow(256, 3 $k);
  7. return $intIp;
  8. }
  9. $arrLines = file(“ip”.“.txt”);
  10. $intLen = 0;
  11. $i = 1;
  12. $resFile = fopen(“ip”.$i.“.sql”, “w”);
  13. foreach ($arrLines as $k => $strLine) {
  14. $arrElements = explode(“||”, addslashes($strLine));
  15. $intIpStart = EncodeIp($arrElements[0]);
  16. $intIpEnd = EncodeIp($arrElements[1]);
  17. $j = 3;
  18. $strAddress = “”;
  19. while ($arrElements[$j]) {
  20. $strAddress .= ” “.$arrElements[$j];
  21. $j++;
  22. }
  23. $strSql = “INSERT INTO ip_data (ipstart, ipend, region, address) VALUES (“.$intIpStart.“, “.$intIpEnd.“, ‘”.trim($arrElements[2]).“‘, ‘”.trim($strAddress).“‘);\r\n”;
  24. fwrite($resFile, $strSql);
  25. $intLen += strlen($strSql);
  26. if ($intLen > 2097152) { // 当正在写入的sql文件超过2M时结束当前文件而开始写入新的sql文件
  27. fclose($resFile);
  28. $resFile = fopen(“ip”.(++$i).“.sql”, “w”);
  29. $intLen = 0;
  30. }
  31. }
  32. ?>

将代码另存为php格式文件,然后放在www文件中,运行,就可以得到27个sql文件了,然后在phpmyadmin中一个一个导入。
开始时,也准备只生成一个sql文件,奈何有50多兆,试了几次,导入时总是超时,还有一次死机了,最后只好老老实实分割成2M的文件一个一个导入,大家也可以写代码自动导入。

也可以到mysql命令行里用命令导入将50多兆的sql文件一次性导入:
首先输入密码进入数据库,然后use ip_data选择ip_data数据库问当前数据库,再输入source c:\ip_data.sql,导入开始,要持续一段时间,耐心等待

整个导入过称持续四十多分钟,导入数据436315条。

 ref: http://willless.com/using-pure-ip-library-to-build-mysql-ip-database.html

使用 shell script 刪除 cloudflare 上的快取

1.先取得 domain name 的 ID

curl -X GET "https://api.cloudflare.com/client/v4/zones?name=網址" \
# -H "X-Auth-Email: test@gmail.com" \
# -H "X-Auth-Key: 7b9fb4xxxxxxxxxxxxxxxxxxxxxxxxxx" \
# -H "Content-Type: application/json" \

X-Auth-Email: 使用帳號
X-Auth-Key: API KEY 在 My settings 裡面可以查看

2.執行後會取得一連串的 json 字串、可以用線上 JSON檢視工具 直接看

3.取得後寫成shell script執行就好了

curl -X DELETE "https://api.cloudflare.com/client/v4/zones/e74b73xxxxxxxxxxxxxxxxxxxxxxxxxx/purge_cache" \
-H "X-Auth-Email: test@gmail.com" \
-H "X-Auth-Key: 7b9fb4xxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
--data '{"purge_everything":true}'

IPdeny country block downloads

IPdeny country block downloads

All country IP block files are provided in CIDR format, at this time. Please note that we compile these lists from regional IP space providers. To correct any errors please contact your local IP space provider e.g. for Europe it’s Ripe, for North America it’s Arin.

IPv6 blocks are available. Please access IPv6 IP address blocks and we recommend using aggregated IPv6 country IP address blocks for best performance.

Note: You may NOW re-distribute our zone files and you can freely use our generated IP zone files in your commercial or freeware solutions or services, please read our Copyright policy and please comply with our Usage limits policy.

NEW! We offer aggregated country IP zone files downloads below. It means fewer rules and higher performance for firewalls, routers and custom solutions! DB ready table formats are coming soon!

Zone files last updated: Tue Sep 26 12:07:25 UTC 2017

Download compressed tar archive with all country zone files: IPv4: all-zones.tar.gz (Size: 565.18 KB) , IPv6: ipv6-all-zones.tar.gz (Size: 111.98 KB)

AFGHANISTAN (AF) [download zone file] Size: 1.30 KB (84 IP blocks) [aggregated zone file] (83 IP blocks)
LAND ISLANDS (AX) [download zone file] Size: 0.01 KB (1 IP blocks) [aggregated zone file] (1 IP blocks)
ALBANIA (AL) [download zone file] Size: 1.45 KB (95 IP blocks) [aggregated zone file] (95 IP blocks)
ALGERIA (DZ) [download zone file] Size: 0.55 KB (37 IP blocks) [aggregated zone file] (37 IP blocks)
AMERICAN SAMOA (AS) [download zone file] Size: 0.03 KB (2 IP blocks) [aggregated zone file] (2 IP blocks)
ANDORRA (AD) [download zone file] Size: 0.18 KB (12 IP blocks) [aggregated zone file] (11 IP blocks)
ANGOLA (AO) [download zone file] Size: 1.15 KB (75 IP blocks) [aggregated zone file] (75 IP blocks)
ANGUILLA (AI) [download zone file] Size: 0.11 KB (7 IP blocks) [aggregated zone file] (7 IP blocks)
ANTIGUA AND BARBUDA (AG) [download zone file] Size: 0.25 KB (16 IP blocks) [aggregated zone file] (16 IP blocks)
ARGENTINA (AR) [download zone file] Size: 20.96 KB (1360 IP blocks) [aggregated zone file] (1087 IP blocks)
ARMENIA (AM) [download zone file] Size: 1.59 KB (105 IP blocks) [aggregated zone file] (104 IP blocks)
ARUBA (AW) [download zone file] Size: 0.09 KB (6 IP blocks) [aggregated zone file] (5 IP blocks)
AUSTRALIA (AU) [download zone file] Size: 114.14 KB (7505 IP blocks) [aggregated zone file] (5198 IP blocks)
AUSTRIA (AT) [download zone file] Size: 22.06 KB (1430 IP blocks) [aggregated zone file] (1280 IP blocks)
AZERBAIJAN (AZ) [download zone file] Size: 1.93 KB (128 IP blocks) [aggregated zone file] (126 IP blocks)
BAHAMAS (BS) [download zone file] Size: 0.25 KB (17 IP blocks) [aggregated zone file] (17 IP blocks)
BAHRAIN (BH) [download zone file] Size: 0.78 KB (52 IP blocks) [aggregated zone file] (51 IP blocks)
BANGLADESH (BD) [download zone file] Size: 12.00 KB (776 IP blocks) [aggregated zone file] (738 IP blocks)
BARBADOS (BB) [download zone file] Size: 0.48 KB (31 IP blocks) [aggregated zone file] (31 IP blocks)
BELARUS (BY) [download zone file] Size: 1.36 KB (90 IP blocks) [aggregated zone file] (87 IP blocks)
BELGIUM (BE) [download zone file] Size: 11.95 KB (786 IP blocks) [aggregated zone file] (744 IP blocks)
BELIZE (BZ) [download zone file] Size: 0.99 KB (64 IP blocks) [aggregated zone file] (62 IP blocks)
BENIN (BJ) [download zone file] Size: 0.41 KB (27 IP blocks) [aggregated zone file] (27 IP blocks)
BERMUDA (BM) [download zone file] Size: 0.67 KB (43 IP blocks) [aggregated zone file] (43 IP blocks)
BHUTAN (BT) [download zone file] Size: 0.27 KB (17 IP blocks) [aggregated zone file] (17 IP blocks)
BOLIVIA (BO) [download zone file] Size: 1.54 KB (100 IP blocks) [aggregated zone file] (84 IP blocks)
BOSNIA AND HERZEGOVINA (BA) [download zone file] Size: 2.07 KB (138 IP blocks) [aggregated zone file] (129 IP blocks)
BOTSWANA (BW) [download zone file] Size: 0.54 KB (36 IP blocks) [aggregated zone file] (36 IP blocks)
BRAZIL (BR) [download zone file] Size: 124.60 KB (8018 IP blocks) [aggregated zone file] (2725 IP blocks)
BRITISH INDIAN OCEAN TERRITORY (IO) [download zone file] Size: 0.03 KB (2 IP blocks) [aggregated zone file] (2 IP blocks)
BRUNEI DARUSSALAM (BN) [download zone file] Size: 0.43 KB (28 IP blocks) [aggregated zone file] (26 IP blocks)
BULGARIA (BG) [download zone file] Size: 15.97 KB (1054 IP blocks) [aggregated zone file] (824 IP blocks)
BURKINA FASO (BF) [download zone file] Size: 0.38 KB (25 IP blocks) [aggregated zone file] (23 IP blocks)
BURUNDI (BI) [download zone file] Size: 0.21 KB (14 IP blocks) [aggregated zone file] (14 IP blocks)
CAMBODIA (KH) [download zone file] Size: 2.42 KB (156 IP blocks) [aggregated zone file] (153 IP blocks)
CAMEROON (CM) [download zone file] Size: 0.60 KB (40 IP blocks) [aggregated zone file] (39 IP blocks)
CANADA (CA) [download zone file] Size: 119.53 KB (7658 IP blocks) [aggregated zone file] (4244 IP blocks)
CAPE VERDE (CV) [download zone file] Size: 0.12 KB (8 IP blocks) [aggregated zone file] (8 IP blocks)
CAYMAN ISLANDS (KY) [download zone file] Size: 0.29 KB (19 IP blocks) [aggregated zone file] (19 IP blocks)
CENTRAL AFRICAN REPUBLIC (CF) [download zone file] Size: 0.09 KB (6 IP blocks) [aggregated zone file] (6 IP blocks)
CHAD (TD) [download zone file] Size: 0.16 KB (10 IP blocks) [aggregated zone file] (10 IP blocks)
CHILE (CL) [download zone file] Size: 10.34 KB (683 IP blocks) [aggregated zone file] (505 IP blocks)
CHINA (CN) [download zone file] Size: 121.11 KB (8007 IP blocks) [aggregated zone file] (4864 IP blocks)
COLOMBIA (CO) [download zone file] Size: 6.68 KB (443 IP blocks) [aggregated zone file] (333 IP blocks)
COMOROS (KM) [download zone file] Size: 0.03 KB (2 IP blocks) [aggregated zone file] (2 IP blocks)
CONGO (CG) [download zone file] Size: 0.25 KB (16 IP blocks) [aggregated zone file] (16 IP blocks)
CONGO, THE DEMOCRATIC REPUBLIC OF THE (CD) [download zone file] Size: 0.62 KB (40 IP blocks) [aggregated zone file] (39 IP blocks)
COOK ISLANDS (CK) [download zone file] Size: 0.01 KB (1 IP blocks) [aggregated zone file] (1 IP blocks)
COSTA RICA (CR) [download zone file] Size: 3.05 KB (197 IP blocks) [aggregated zone file] (162 IP blocks)
COTE D’IVOIRE (CI) [download zone file] Size: 0.50 KB (33 IP blocks) [aggregated zone file] (32 IP blocks)
CROATIA (HR) [download zone file] Size: 2.88 KB (189 IP blocks) [aggregated zone file] (183 IP blocks)
CUBA (CU) [download zone file] Size: 0.31 KB (21 IP blocks) [aggregated zone file] (17 IP blocks)
CYPRUS (CY) [download zone file] Size: 2.96 KB (191 IP blocks) [aggregated zone file] (190 IP blocks)
CZECH REPUBLIC (CZ) [download zone file] Size: 18.10 KB (1186 IP blocks) [aggregated zone file] (1126 IP blocks)
DENMARK (DK) [download zone file] Size: 17.11 KB (1118 IP blocks) [aggregated zone file] (895 IP blocks)
DJIBOUTI (DJ) [download zone file] Size: 0.09 KB (6 IP blocks) [aggregated zone file] (6 IP blocks)
DOMINICA (DM) [download zone file] Size: 0.14 KB (9 IP blocks) [aggregated zone file] (9 IP blocks)
DOMINICAN REPUBLIC (DO) [download zone file] Size: 1.62 KB (107 IP blocks) [aggregated zone file] (86 IP blocks)
ECUADOR (EC) [download zone file] Size: 4.29 KB (286 IP blocks) [aggregated zone file] (184 IP blocks)
EGYPT (EG) [download zone file] Size: 2.43 KB (164 IP blocks) [aggregated zone file] (156 IP blocks)
EL SALVADOR (SV) [download zone file] Size: 1.01 KB (66 IP blocks) [aggregated zone file] (58 IP blocks)
EQUATORIAL GUINEA (GQ) [download zone file] Size: 0.14 KB (9 IP blocks) [aggregated zone file] (9 IP blocks)
ERITREA (ER) [download zone file] Size: 0.02 KB (1 IP blocks) [aggregated zone file] (1 IP blocks)
ESTONIA (EE) [download zone file] Size: 3.21 KB (211 IP blocks) [aggregated zone file] (208 IP blocks)
ETHIOPIA (ET) [download zone file] Size: 0.08 KB (5 IP blocks) [aggregated zone file] (5 IP blocks)
FAROE ISLANDS (FO) [download zone file] Size: 0.18 KB (12 IP blocks) [aggregated zone file] (12 IP blocks)
FIJI (FJ) [download zone file] Size: 0.49 KB (32 IP blocks) [aggregated zone file] (30 IP blocks)
FINLAND (FI) [download zone file] Size: 14.17 KB (929 IP blocks) [aggregated zone file] (802 IP blocks)
FRANCE (FR) [download zone file] Size: 49.52 KB (3244 IP blocks) [aggregated zone file] (2821 IP blocks)
FRENCH GUIANA (GF) [download zone file] Size: 0.08 KB (5 IP blocks) [aggregated zone file] (5 IP blocks)
FRENCH POLYNESIA (PF) [download zone file] Size: 0.22 KB (14 IP blocks) [aggregated zone file] (14 IP blocks)
GABON (GA) [download zone file] Size: 0.51 KB (33 IP blocks) [aggregated zone file] (33 IP blocks)
GAMBIA (GM) [download zone file] Size: 0.23 KB (15 IP blocks) [aggregated zone file] (15 IP blocks)
GEORGIA (GE) [download zone file] Size: 2.49 KB (163 IP blocks) [aggregated zone file] (148 IP blocks)
GERMANY (DE) [download zone file] Size: 102.33 KB (6683 IP blocks) [aggregated zone file] (5723 IP blocks)
GHANA (GH) [download zone file] Size: 1.53 KB (101 IP blocks) [aggregated zone file] (99 IP blocks)
GIBRALTAR (GI) [download zone file] Size: 0.46 KB (30 IP blocks) [aggregated zone file] (30 IP blocks)
GREECE (GR) [download zone file] Size: 5.44 KB (359 IP blocks) [aggregated zone file] (348 IP blocks)
GREENLAND (GL) [download zone file] Size: 0.14 KB (9 IP blocks) [aggregated zone file] (9 IP blocks)
GRENADA (GD) [download zone file] Size: 0.14 KB (9 IP blocks) [aggregated zone file] (9 IP blocks)
GUADELOUPE (GP) [download zone file] Size: 0.11 KB (7 IP blocks) [aggregated zone file] (7 IP blocks)
GUAM (GU) [download zone file] Size: 0.43 KB (28 IP blocks) [aggregated zone file] (26 IP blocks)
GUATEMALA (GT) [download zone file] Size: 1.16 KB (74 IP blocks) [aggregated zone file] (59 IP blocks)
GUINEA (GN) [download zone file] Size: 0.18 KB (12 IP blocks) [aggregated zone file] (12 IP blocks)
GUINEA-BISSAU (GW) [download zone file] Size: 0.04 KB (3 IP blocks) [aggregated zone file] (3 IP blocks)
GUYANA (GY) [download zone file] Size: 0.19 KB (12 IP blocks) [aggregated zone file] (11 IP blocks)
HAITI (HT) [download zone file] Size: 0.41 KB (26 IP blocks) [aggregated zone file] (21 IP blocks)
HOLY SEE (VATICAN CITY STATE) (VA) [download zone file] Size: 0.11 KB (7 IP blocks) [aggregated zone file] (7 IP blocks)
HONDURAS (HN) [download zone file] Size: 2.72 KB (176 IP blocks) [aggregated zone file] (171 IP blocks)
HONG KONG (HK) [download zone file] Size: 33.50 KB (2181 IP blocks) [aggregated zone file] (1872 IP blocks)
HUNGARY (HU) [download zone file] Size: 7.79 KB (513 IP blocks) [aggregated zone file] (476 IP blocks)
ICELAND (IS) [download zone file] Size: 1.90 KB (123 IP blocks) [aggregated zone file] (121 IP blocks)
INDIA (IN) [download zone file] Size: 81.18 KB (5252 IP blocks) [aggregated zone file] (3953 IP blocks)
INDONESIA (ID) [download zone file] Size: 29.75 KB (1928 IP blocks) [aggregated zone file] (1688 IP blocks)
IRAN, ISLAMIC REPUBLIC OF (IR) [download zone file] Size: 19.51 KB (1278 IP blocks) [aggregated zone file] (1171 IP blocks)
IRAQ (IQ) [download zone file] Size: 2.28 KB (148 IP blocks) [aggregated zone file] (147 IP blocks)
IRELAND (IE) [download zone file] Size: 8.03 KB (527 IP blocks) [aggregated zone file] (504 IP blocks)
ISLE OF MAN (IM) [download zone file] Size: 0.25 KB (17 IP blocks) [aggregated zone file] (17 IP blocks)
ISRAEL (IL) [download zone file] Size: 7.87 KB (511 IP blocks) [aggregated zone file] (432 IP blocks)
ITALY (IT) [download zone file] Size: 34.93 KB (2294 IP blocks) [aggregated zone file] (2136 IP blocks)
JAMAICA (JM) [download zone file] Size: 0.66 KB (44 IP blocks) [aggregated zone file] (43 IP blocks)
JAPAN (JP) [download zone file] Size: 62.97 KB (4146 IP blocks) [aggregated zone file] (2752 IP blocks)
JERSEY (JE) [download zone file] Size: 0.21 KB (14 IP blocks) [aggregated zone file] (14 IP blocks)
JORDAN (JO) [download zone file] Size: 1.66 KB (108 IP blocks) [aggregated zone file] (108 IP blocks)
KAZAKHSTAN (KZ) [download zone file] Size: 4.42 KB (292 IP blocks) [aggregated zone file] (283 IP blocks)
KENYA (KE) [download zone file] Size: 2.42 KB (160 IP blocks) [aggregated zone file] (157 IP blocks)
KIRIBATI (KI) [download zone file] Size: 0.08 KB (5 IP blocks) [aggregated zone file] (5 IP blocks)
KOREA, DEMOCRATIC PEOPLE’S REPUBLIC OF (KP) [download zone file] Size: 0.02 KB (1 IP blocks) [aggregated zone file] (1 IP blocks)
KOREA, REPUBLIC OF (KR) [download zone file] Size: 16.83 KB (1121 IP blocks) [aggregated zone file] (895 IP blocks)
KUWAIT (KW) [download zone file] Size: 1.85 KB (121 IP blocks) [aggregated zone file] (119 IP blocks)
KYRGYZSTAN (KG) [download zone file] Size: 1.07 KB (70 IP blocks) [aggregated zone file] (70 IP blocks)
LAO PEOPLE’S DEMOCRATIC REPUBLIC (LA) [download zone file] Size: 0.49 KB (32 IP blocks) [aggregated zone file] (32 IP blocks)
LATVIA (LV) [download zone file] Size: 5.11 KB (338 IP blocks) [aggregated zone file] (322 IP blocks)
LEBANON (LB) [download zone file] Size: 2.95 KB (190 IP blocks) [aggregated zone file] (189 IP blocks)
LESOTHO (LS) [download zone file] Size: 0.27 KB (17 IP blocks) [aggregated zone file] (17 IP blocks)
LIBERIA (LR) [download zone file] Size: 0.18 KB (12 IP blocks) [aggregated zone file] (12 IP blocks)
LIBYAN ARAB JAMAHIRIYA (LY) [download zone file] Size: 0.36 KB (24 IP blocks) [aggregated zone file] (24 IP blocks)
LIECHTENSTEIN (LI) [download zone file] Size: 0.71 KB (46 IP blocks) [aggregated zone file] (46 IP blocks)
LITHUANIA (LT) [download zone file] Size: 4.42 KB (292 IP blocks) [aggregated zone file] (276 IP blocks)
LUXEMBOURG (LU) [download zone file] Size: 2.98 KB (195 IP blocks) [aggregated zone file] (188 IP blocks)
MACAO (MO) [download zone file] Size: 0.51 KB (33 IP blocks) [aggregated zone file] (25 IP blocks)
MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF (MK) [download zone file] Size: 1.83 KB (122 IP blocks) [aggregated zone file] (84 IP blocks)
MADAGASCAR (MG) [download zone file] Size: 0.30 KB (20 IP blocks) [aggregated zone file] (20 IP blocks)
MALAWI (MW) [download zone file] Size: 0.43 KB (29 IP blocks) [aggregated zone file] (29 IP blocks)
MALAYSIA (MY) [download zone file] Size: 10.17 KB (659 IP blocks) [aggregated zone file] (544 IP blocks)
MALDIVES (MV) [download zone file] Size: 0.35 KB (23 IP blocks) [aggregated zone file] (21 IP blocks)
MALI (ML) [download zone file] Size: 0.25 KB (16 IP blocks) [aggregated zone file] (16 IP blocks)
MALTA (MT) [download zone file] Size: 1.37 KB (91 IP blocks) [aggregated zone file] (91 IP blocks)
MARSHALL ISLANDS (MH) [download zone file] Size: 0.05 KB (3 IP blocks) [aggregated zone file] (3 IP blocks)
MARTINIQUE (MQ) [download zone file] Size: 0.06 KB (4 IP blocks) [aggregated zone file] (4 IP blocks)
MAURITANIA (MR) [download zone file] Size: 0.10 KB (7 IP blocks) [aggregated zone file] (7 IP blocks)
MAURITIUS (MU) [download zone file] Size: 1.37 KB (90 IP blocks) [aggregated zone file] (87 IP blocks)
MAYOTTE (YT) [download zone file] Size: 0.02 KB (1 IP blocks) [aggregated zone file] (1 IP blocks)
MEXICO (MX) [download zone file] Size: 17.31 KB (1127 IP blocks) [aggregated zone file] (551 IP blocks)
MICRONESIA, FEDERATED STATES OF (FM) [download zone file] Size: 0.06 KB (4 IP blocks) [aggregated zone file] (4 IP blocks)
MOLDOVA, REPUBLIC OF (MD) [download zone file] Size: 5.19 KB (340 IP blocks) [aggregated zone file] (328 IP blocks)
MONACO (MC) [download zone file] Size: 0.17 KB (11 IP blocks) [aggregated zone file] (11 IP blocks)
MONGOLIA (MN) [download zone file] Size: 1.17 KB (76 IP blocks) [aggregated zone file] (75 IP blocks)
MONTENEGRO (ME) [download zone file] Size: 0.60 KB (40 IP blocks) [aggregated zone file] (40 IP blocks)
MONTSERRAT (MS) [download zone file] Size: 0.03 KB (2 IP blocks) [aggregated zone file] (2 IP blocks)
MOROCCO (MA) [download zone file] Size: 0.80 KB (54 IP blocks) [aggregated zone file] (52 IP blocks)
MOZAMBIQUE (MZ) [download zone file] Size: 0.70 KB (46 IP blocks) [aggregated zone file] (46 IP blocks)
MYANMAR (MM) [download zone file] Size: 1.36 KB (88 IP blocks) [aggregated zone file] (87 IP blocks)
NAMIBIA (NA) [download zone file] Size: 0.45 KB (30 IP blocks) [aggregated zone file] (30 IP blocks)
NAURU (NR) [download zone file] Size: 0.09 KB (6 IP blocks) [aggregated zone file] (6 IP blocks)
NEPAL (NP) [download zone file] Size: 1.68 KB (110 IP blocks) [aggregated zone file] (106 IP blocks)
NETHERLANDS (NL) [download zone file] Size: 55.94 KB (3648 IP blocks) [aggregated zone file] (3175 IP blocks)
NEW CALEDONIA (NC) [download zone file] Size: 0.63 KB (41 IP blocks) [aggregated zone file] (37 IP blocks)
NEW ZEALAND (NZ) [download zone file] Size: 24.68 KB (1610 IP blocks) [aggregated zone file] (941 IP blocks)
NICARAGUA (NI) [download zone file] Size: 0.69 KB (45 IP blocks) [aggregated zone file] (41 IP blocks)
NIGER (NE) [download zone file] Size: 0.11 KB (7 IP blocks) [aggregated zone file] (7 IP blocks)
NIGERIA (NG) [download zone file] Size: 3.38 KB (223 IP blocks) [aggregated zone file] (215 IP blocks)
NIUE (NU) [download zone file] Size: 0.03 KB (2 IP blocks) [aggregated zone file] (2 IP blocks)
NORFOLK ISLAND (NF) [download zone file] Size: 0.06 KB (4 IP blocks) [aggregated zone file] (4 IP blocks)
NORTHERN MARIANA ISLANDS (MP) [download zone file] Size: 0.09 KB (6 IP blocks) [aggregated zone file] (5 IP blocks)
NORWAY (NO) [download zone file] Size: 16.63 KB (1093 IP blocks) [aggregated zone file] (1008 IP blocks)
OMAN (OM) [download zone file] Size: 0.54 KB (37 IP blocks) [aggregated zone file] (37 IP blocks)
PAKISTAN (PK) [download zone file] Size: 5.66 KB (368 IP blocks) [aggregated zone file] (339 IP blocks)
PALAU (PW) [download zone file] Size: 0.05 KB (3 IP blocks) [aggregated zone file] (3 IP blocks)
PALESTINIAN TERRITORY, OCCUPIED (PS) [download zone file] Size: 1.90 KB (127 IP blocks) [aggregated zone file] (123 IP blocks)
PANAMA (PA) [download zone file] Size: 2.37 KB (154 IP blocks) [aggregated zone file] (119 IP blocks)
PAPUA NEW GUINEA (PG) [download zone file] Size: 0.58 KB (38 IP blocks) [aggregated zone file] (38 IP blocks)
PARAGUAY (PY) [download zone file] Size: 1.14 KB (73 IP blocks) [aggregated zone file] (64 IP blocks)
PERU (PE) [download zone file] Size: 2.62 KB (172 IP blocks) [aggregated zone file] (137 IP blocks)
PHILIPPINES (PH) [download zone file] Size: 7.70 KB (503 IP blocks) [aggregated zone file] (450 IP blocks)
POLAND (PL) [download zone file] Size: 53.44 KB (3474 IP blocks) [aggregated zone file] (3242 IP blocks)
PORTUGAL (PT) [download zone file] Size: 5.80 KB (381 IP blocks) [aggregated zone file] (343 IP blocks)
PUERTO RICO (PR) [download zone file] Size: 2.12 KB (139 IP blocks) [aggregated zone file] (136 IP blocks)
QATAR (QA) [download zone file] Size: 0.40 KB (27 IP blocks) [aggregated zone file] (27 IP blocks)
REUNION (RE) [download zone file] Size: 0.18 KB (12 IP blocks) [aggregated zone file] (11 IP blocks)
ROMANIA (RO) [download zone file] Size: 46.20 KB (3051 IP blocks) [aggregated zone file] (2300 IP blocks)
RUSSIAN FEDERATION (RU) [download zone file] Size: 123.30 KB (8076 IP blocks) [aggregated zone file] (6874 IP blocks)
RWANDA (RW) [download zone file] Size: 0.29 KB (19 IP blocks) [aggregated zone file] (19 IP blocks)
SAINT KITTS AND NEVIS (KN) [download zone file] Size: 0.11 KB (7 IP blocks) [aggregated zone file] (7 IP blocks)
SAINT LUCIA (LC) [download zone file] Size: 0.22 KB (14 IP blocks) [aggregated zone file] (14 IP blocks)
SAINT PIERRE AND MIQUELON (PM) [download zone file] Size: 0.01 KB (1 IP blocks) [aggregated zone file] (1 IP blocks)
SAINT VINCENT AND THE GRENADINES (VC) [download zone file] Size: 0.13 KB (8 IP blocks) [aggregated zone file] (8 IP blocks)
SAMOA (WS) [download zone file] Size: 0.17 KB (11 IP blocks) [aggregated zone file] (11 IP blocks)
SAN MARINO (SM) [download zone file] Size: 0.23 KB (15 IP blocks) [aggregated zone file] (15 IP blocks)
SAO TOME AND PRINCIPE (ST) [download zone file] Size: 0.03 KB (2 IP blocks) [aggregated zone file] (2 IP blocks)
SAUDI ARABIA (SA) [download zone file] Size: 5.53 KB (369 IP blocks) [aggregated zone file] (357 IP blocks)
SENEGAL (SN) [download zone file] Size: 0.36 KB (25 IP blocks) [aggregated zone file] (19 IP blocks)
SERBIA (RS) [download zone file] Size: 4.86 KB (317 IP blocks) [aggregated zone file] (306 IP blocks)
SEYCHELLES (SC) [download zone file] Size: 1.04 KB (69 IP blocks) [aggregated zone file] (59 IP blocks)
SIERRA LEONE (SL) [download zone file] Size: 0.25 KB (16 IP blocks) [aggregated zone file] (16 IP blocks)
SINGAPORE (SG) [download zone file] Size: 18.94 KB (1228 IP blocks) [aggregated zone file] (1117 IP blocks)
SLOVAKIA (SK) [download zone file] Size: 5.28 KB (345 IP blocks) [aggregated zone file] (326 IP blocks)
SLOVENIA (SI) [download zone file] Size: 6.58 KB (430 IP blocks) [aggregated zone file] (421 IP blocks)
SOLOMON ISLANDS (SB) [download zone file] Size: 0.09 KB (6 IP blocks) [aggregated zone file] (6 IP blocks)
SOMALIA (SO) [download zone file] Size: 0.23 KB (15 IP blocks) [aggregated zone file] (15 IP blocks)
SOUTH AFRICA (ZA) [download zone file] Size: 22.91 KB (1523 IP blocks) [aggregated zone file] (986 IP blocks)
SPAIN (ES) [download zone file] Size: 30.98 KB (2024 IP blocks) [aggregated zone file] (1869 IP blocks)
SRI LANKA (LK) [download zone file] Size: 0.89 KB (58 IP blocks) [aggregated zone file] (51 IP blocks)
SUDAN (SD) [download zone file] Size: 0.40 KB (27 IP blocks) [aggregated zone file] (26 IP blocks)
SURINAME (SR) [download zone file] Size: 0.17 KB (11 IP blocks) [aggregated zone file] (8 IP blocks)
SWAZILAND (SZ) [download zone file] Size: 0.22 KB (15 IP blocks) [aggregated zone file] (15 IP blocks)
SWEDEN (SE) [download zone file] Size: 26.65 KB (1754 IP blocks) [aggregated zone file] (1630 IP blocks)
SWITZERLAND (CH) [download zone file] Size: 31.18 KB (2031 IP blocks) [aggregated zone file] (1861 IP blocks)
SYRIAN ARAB REPUBLIC (SY) [download zone file] Size: 2.96 KB (191 IP blocks) [aggregated zone file] (173 IP blocks)
TAIWAN (TW) [download zone file] Size: 9.50 KB (632 IP blocks) [aggregated zone file] (447 IP blocks)
TAJIKISTAN (TJ) [download zone file] Size: 0.39 KB (26 IP blocks) [aggregated zone file] (26 IP blocks)
TANZANIA, UNITED REPUBLIC OF (TZ) [download zone file] Size: 1.60 KB (106 IP blocks) [aggregated zone file] (104 IP blocks)
THAILAND (TH) [download zone file] Size: 9.27 KB (609 IP blocks) [aggregated zone file] (484 IP blocks)
TIMOR-LESTE (TL) [download zone file] Size: 0.20 KB (13 IP blocks) [aggregated zone file] (13 IP blocks)
TOGO (TG) [download zone file] Size: 0.15 KB (10 IP blocks) [aggregated zone file] (10 IP blocks)
TOKELAU (TK) [download zone file] Size: 0.01 KB (1 IP blocks) [aggregated zone file] (1 IP blocks)
TONGA (TO) [download zone file] Size: 0.11 KB (7 IP blocks) [aggregated zone file] (7 IP blocks)
TRINIDAD AND TOBAGO (TT) [download zone file] Size: 0.78 KB (52 IP blocks) [aggregated zone file] (47 IP blocks)
TUNISIA (TN) [download zone file] Size: 0.30 KB (20 IP blocks) [aggregated zone file] (20 IP blocks)
TURKEY (TR) [download zone file] Size: 14.09 KB (923 IP blocks) [aggregated zone file] (849 IP blocks)
TURKMENISTAN (TM) [download zone file] Size: 0.08 KB (5 IP blocks) [aggregated zone file] (5 IP blocks)
TURKS AND CAICOS ISLANDS (TC) [download zone file] Size: 0.11 KB (7 IP blocks) [aggregated zone file] (7 IP blocks)
TUVALU (TV) [download zone file] Size: 0.01 KB (1 IP blocks) [aggregated zone file] (1 IP blocks)
UGANDA (UG) [download zone file] Size: 0.81 KB (53 IP blocks) [aggregated zone file] (53 IP blocks)
UKRAINE (UA) [download zone file] Size: 45.97 KB (2978 IP blocks) [aggregated zone file] (2742 IP blocks)
UNITED ARAB EMIRATES (AE) [download zone file] Size: 2.14 KB (143 IP blocks) [aggregated zone file] (134 IP blocks)
UNITED KINGDOM (GB) [download zone file] Size: 102.30 KB (6707 IP blocks) [aggregated zone file] (5937 IP blocks)
UNITED STATES (US) [download zone file] Size: 793.47 KB (51490 IP blocks) [aggregated zone file] (16647 IP blocks)
UNITED STATES MINOR OUTLYING ISLANDS (UM) [download zone file] Size: 0.02 KB (1 IP blocks) [aggregated zone file] (1 IP blocks)
URUGUAY (UY) [download zone file] Size: 1.22 KB (81 IP blocks) [aggregated zone file] (49 IP blocks)
UZBEKISTAN (UZ) [download zone file] Size: 1.03 KB (67 IP blocks) [aggregated zone file] (66 IP blocks)
VANUATU (VU) [download zone file] Size: 0.28 KB (18 IP blocks) [aggregated zone file] (18 IP blocks)
VENEZUELA (VE) [download zone file] Size: 3.02 KB (201 IP blocks) [aggregated zone file] (158 IP blocks)
VIET NAM (VN) [download zone file] Size: 8.93 KB (584 IP blocks) [aggregated zone file] (475 IP blocks)
VIRGIN ISLANDS, BRITISH (VG) [download zone file] Size: 1.21 KB (80 IP blocks) [aggregated zone file] (80 IP blocks)
VIRGIN ISLANDS, U.S. (VI) [download zone file] Size: 0.23 KB (15 IP blocks) [aggregated zone file] (15 IP blocks)
WALLIS AND FUTUNA (WF) [download zone file] Size: 0.05 KB (3 IP blocks) [aggregated zone file] (3 IP blocks)
YEMEN (YE) [download zone file] Size: 0.25 KB (17 IP blocks) [aggregated zone file] (17 IP blocks)
ZAMBIA (ZM) [download zone file] Size: 0.46 KB (31 IP blocks) [aggregated zone file] (31 IP blocks)
ZIMBABWE (ZW) [download zone file] Size: 0.39 KB (26 IP blocks) [aggregated zone file] (26 IP blocks)

You can also directly access country IP block files directory here.
md5 check sum file is also provided. For agreggated data please download MD5SUM here.

refer from http://www.ipdeny.com/ipblocks/

Graphical Network Simulator (GNS3) 是一個網絡設備模擬器軟件,主要模擬 Cisco 的 Router、Switch 和 Firewall,對學習 Network 的朋友們確實是超大的喜訊,尤其是正在攻略 Cisco 考試的朋友們。筆者聽說過在沒有 GNS3 的年代,曾經有師兄為了學習 CCIE Lab,就花了十萬港元去購買一隻 Cisco 4503!現在我們真是很幸福了!

Graphical Network Simulator (GNS3) 是一個網絡設備模擬器軟件,主要模擬 Cisco 的 Router、Switch 和 Firewall,對學習 Network 的朋友們確實是超大的喜訊,尤其是正在攻略 Cisco 考試的朋友們。筆者聽說過在沒有 GNS3 的年代,曾經有師兄為了學習 CCIE Lab,就花了十萬港元去購買一隻 Cisco 4503!現在我們真是很幸福了!

SPINE: Poller[0] ERROR: Spine Timed Out While Processing Hosts Internal

http://blog.pnyet.web.id/2013/01/07/solved-error-spine-timed-out-while-processing-hosts-internal.html

 

 

 

cacti_host_internal

[Solved] SPINE: Poller[0] ERROR: Spine Timed Out While Processing Hosts Internal

cacti_host_internalFew days ago I’ve a problem when installing cacti 0.8.8a, and only 3 devices that successfully graphed. My cacti running on CentOS 6.3 x86_64 with core i7 and 8GB ram, 240GB SSD and will used for populate about 3000 – 3500 data sources. First time I ran the cacti and everything work fine and I can add about 4 graphs on two devices and the graph is normal.

The problem come after generate about 300 graphs and the new graph doesn’t show. I got the following error message from cacti.log:

 01/02/2013 06:59:06 AM - SPINE: Poller[0] ERROR: Spine Timed Out 
 While Processing Hosts Internal
 01/02/2013 06:59:06 AM - SPINE: Poller[0] ERROR: Spine Timed Out
 While Processing Hosts Internal
 01/02/2013 07:00:08 AM - SPINE: Poller[0] ERROR: Spine Timed Out
 While Processing Hosts Internal
 01/02/2013 07:00:08 AM - SPINE: Poller[0] ERROR: Spine Timed Out
 While Processing Hosts Internal
 01/02/2013 07:01:07 AM - SPINE: Poller[0] ERROR: Spine Timed Out
 While Processing Hosts Internal
 01/02/2013 07:01:07 AM - SPINE: Poller[0] ERROR: Spine Timed Out
 While Processing Hosts Internal
 01/02/2013 07:02:08 AM - SPINE: Poller[0] ERROR: Spine Timed Out
 While Processing Hosts Internal
 01/02/2013 07:02:08 AM - SPINE: Poller[0] ERROR: Spine Timed Out
 While Processing Hosts Internal
 01/02/2013 07:03:10 AM - SPINE: Poller[0] ERROR: Spine Timed Out 
 While Processing Hosts Internal
 01/02/2013 07:03:10 AM - SPINE: Poller[0] ERROR: Spine Timed Out 
 While Processing Hosts Internal
 01/02/2013 07:04:07 AM - SPINE: Poller[0] ERROR: Spine Timed Out
 While Processing Hosts Internal

After got the error log in above, I did the following steps:

1. Modify PHP execution time limit ini php.ini and change the maximum execution time from 60 second to 180 second
# vi php.ini
max_execution_time = 180

2. Increase script server time out value from 60 second to 180 or above depend on yours, go to cacti console enter to setting menu and then change “Script and Script Server Timeout Value” from 60 to 180 or above.

If two step in above doesn’t work

also try to modify mysql & php config.

How to change max_connections

You can change max_connections while MySQL is running via SET:

mysql> SET GLOBAL max_connections = 5000;
Query OK, 0 rows affected (0.00 sec)

mysql> SHOW VARIABLES LIKE "max_connections";
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| max_connections | 5000  |
+-----------------+-------+
1 row in set (0.00 sec)

 

 

Technical Note: How to access natted server internally with Public IP address : Loopback policy

Products
FortiGate v5.0
FortiGate v5.2
Description
This article explains how to access the natted server internally with the Public IP/Virtual IP.
Solution
Step 1: Configure VIP

Log in to the GUI and go to Policy & Objects > Objects > Virtual IPs > Create new, set the following parameters:

Name: Give any friendly name, for example: Virtual IP.
Interface: “Any”
External IP: “Public IP/Virtual IP of the Server”, for example: 1.1.1.1 (WAN1)
Mapped IP: “Private IP/Internal IP of the Server”, for example: 192.168.1.10
Port Forwarding needs to be checked if the port is to be specified.

Step 2: Configure Policy

Incoming Interface : Wan1
Source Address : All
Outgoing Interface : Internal
Destination Address: Virtual IP
Service: HTTP (Specify the service to be used to access the server).

Select Ok

If NAT is selected, the source address is changed to the internal interface address. Normally, you would not want to perform source NAT since this has the effect of hiding the actual source address of the sessions.

Step 3: Configure Policy Route

Router > Static > Policy route > Create new >

Incoming Interface: Internal (select the local LAN interface)
Source Address: Specify the Local LAN Network
Destination Address: Specify the VIP configured “LOCAL IP”
Outgoing Interface: Internal (select the VIP server’s local interface)
No Gateway is Required

Move the created policy route to the top of existing policy route.

ref from: http://kb.fortinet.com/kb/microsites/search.do?cmd=displayKC&docType=kc&externalId=FD36657&sliceId=1&docTypeID=DT_KCARTICLE_1_1&dialogID=96206726&stateId=0%200%2096204818