利用BIND的VIEW功能實現國內國處用戶解析到不同服務器的智能解析

用BIND智能解析實現國內外用戶訪問不同的服務器.

前提:假設你已經安裝好BIND,並測試通過.

  假設,192.168.0.2IP爲國內服務器的IP
           192.168.0.3IP爲國外服務器IP

主要用到BIND的VIEW功能,下面是named.conf裏面智能理析功能的代碼

include "chinaiplist.acl";

view 
"china"{
  match-clients{
  china
;//比較重要的就是這裏了,如果是中國的IP列表,則使用下面的域名解析

}
;

zone 
"." {
        type hint
;
        file "named.root";
};

zone 
"0.0.127.IN-ADDR.ARPA" {
        type master
;
        file "localhost.rev";
};

zone 
"test.com" {
        type master
;
        file "china.test.com";
        allow-transfer {
                
192.168.0.2;
                common-allow-transfer;
        };
};

}
;


view 
"view_any"{
match-clients{any
;};
//如果不是,使用下面的....

zone 
"." {
        type hint
;
        file "named.root";
};

zone 
"0.0.127.IN-ADDR.ARPA" {
        type master
;
        file "localhost.rev";
};

zone 
"test.com" {
        type master
;
        file "test.com";
        allow-transfer {
               192.168.0.3
                common-allow-transfer;
        };
};

};

然後在test.com.和china.test.com裏面做好A記錄.

附:一.chinaiplist.acl

acl china{
61.14.29.8;
61.14.29.9;
61.14.29.10;
61.14.29.11;
61.14.29.12;
61.14.29.13;
61.14.29.14;
61.14.29.15;
61.14.29.80;
61.14.29.81;
61.14.29.82;
61.14.29.83;
61.14.29.84;
61.14.29.85;
61.14.29.86;
61.14.29.87;
61.14.29.88;
61.14.29.89;
61.14.29.90;
61.14.29.91;
61.14.29.92;
61.14.29.93;
61.14.29.94;
61.14.29.95;
61.161.155.0;
61.161.155.1;
61.161.155.2;
61.161.155.3;
61.128.155.0;
61.128.155.1;
61.128.155.2;
61.128.155.3;
61.128.155.4;
61.128.155.5;
61.128.155.6;
61.128.155.7;
61.128.155.8;
61.128.155.9;
61.128.155.10;
61.128.155.11;
61.128.155.12;
61.128.155.13;
61.128.155.14;
61.128.155.15;
61.128.155.16;
61.128.155.17;
61.128.155.18;
61.128.155.19;
61.128.155.20;
61.128.155.21;
61.128.155.22;
61.128.155.23;
61.128.155.24;
61.128.155.25;
61.128.155.26;
61.128.155.27;
61.128.155.28;
61.128.155.29;
61.128.155.30;
61.128.155.31;
61.128.155.32;
61.128.155.33;
61.128.155.34;
61.128.155.35;
61.128.155.36;
61.128.155.37;
61.128.155.38;
61.128.155.39;
61.128.155.40;
61.128.155.41;
61.128.155.42;
61.128.155.43;
61.128.155.44;
61.128.155.45;
61.128.155.46;
61.128.155.47;
61.128.155.48;
61.128.155.49;
61.128.155.50;
61.128.155.51;
61.128.155.52;
61.128.155.53;
61.128.155.54;
61.128.155.55;
63.150.129.120;
63.150.129.121;
63.150.129.122;
63.150.129.123;
63.150.129.124;
63.150.129.125;
63.150.129.126;
63.150.129.127;
63.246.132.30;
63.246.132.31;
63.246.132.32;
63.246.132.33;
63.246.132.34;
63.246.132.35;
63.246.132.36;
63.246.132.37;
63.246.132.38;
63.246.132.39;
69.95.96.0;
69.95.96.1;
69.95.96.2;
69.95.96.3;
69.95.96.4;
69.95.96.5;
69.95.96.6;
69.95.96.7;
72.32.164.88;
72.32.164.89;
72.32.164.90;
72.32.164.91;
72.32.164.92;
72.32.164.93;
72.32.164.94;
72.32.164.95;
203.98.207.0;
203.98.207.1;
203.98.207.2;
203.98.207.3;
203.98.207.4;
203.98.207.5;
203.98.207.6;
203.98.207.7;
203.98.207.80;
203.98.207.81;
203.98.207.82;
203.98.207.83;
203.98.207.84;
203.98.207.85;
203.98.207.86;
203.98.207.87;
203.98.207.88;
203.98.207.89;
203.98.207.90;
203.98.207.91;
203.98.207.92;
203.98.207.93;
203.98.207.94;
203.98.207.95;
203.98.207.96;
203.98.207.97;
203.98.207.98;
203.98.207.99;
203.98.207.100;
203.98.207.101;
203.98.207.102;
203.98.207.103;
203.98.207.104;
203.98.207.105;
203.98.207.106;
203.98.207.107;
203.98.207.108;
203.98.207.109;
203.98.207.110;
203.98.207.111;
203.98.210.96;
203.98.210.97;
203.98.210.98;
203.98.210.99;
203.98.210.100;
203.98.210.101;
203.98.210.102;
203.98.210.103;
203.142.12.128;
203.142.12.129;
203.142.12.130;
203.142.12.131;
203.142.12.132;
203.142.12.133;
203.142.12.134;
203.142.12.135;
203.142.12.136;
203.142.12.137;
203.142.12.138;
203.142.12.139;
203.142.12.140;
203.142.12.141;
203.142.12.142;
203.142.12.143;
203.142.12.144;
203.142.12.145;
203.142.12.146;
203.142.12.147;
203.142.12.148;
203.142.12.149;
203.142.12.150;
203.142.12.151;
203.142.12.152;
203.142.12.153;
203.142.12.154;
203.142.12.155;
203.142.12.156;
203.142.12.157;
203.142.12.158;
203.142.12.159;
203.142.12.160;
203.142.12.161;
203.142.12.162;
203.142.12.163;
203.142.12.164;
203.142.12.165;
203.142.12.166;
203.142.12.167;
203.142.12.168;
203.142.12.169;
203.142.12.170;
203.142.12.171;
203.142.12.172;
203.142.12.173;
203.142.12.174;
203.142.12.175;
203.142.12.176;
203.142.12.177;
203.142.12.178;
203.142.12.179;
203.142.12.180;
203.142.12.181;
203.142.12.182;
203.142.12.183;
203.142.12.184;
203.142.12.185;
203.142.12.186;
203.142.12.187;
203.142.12.188;
203.142.12.189;
203.142.12.190;
203.142.12.191;
203.222.44.168;
203.222.44.169;
203.222.44.170;
203.222.44.171;
203.222.44.172;
203.222.44.173;
203.222.44.174;
203.222.44.175;
203.222.177.0;
203.222.177.1;
203.222.177.2;
203.222.177.3;
203.222.177.4;
203.222.177.5;
203.222.177.6;
203.222.177.7;
203.222.177.8;
203.222.177.9;
203.222.177.10;
203.222.177.11;
203.222.177.12;
203.222.177.13;
203.222.177.14;
203.222.177.15;
203.222.177.16;
203.222.177.17;
203.222.177.18;
203.222.177.19;
203.222.177.20;
203.222.177.21;
203.222.177.22;
203.222.177.23;
203.222.177.24;
203.222.177.25;
203.222.177.26;
203.222.177.27;
203.222.177.28;
203.222.177.29;
203.222.177.30;
203.222.177.31;
203.222.177.32;
203.222.177.33;
203.222.177.34;
203.222.177.35;
203.222.177.36;
203.222.177.37;
203.222.177.38;
203.222.177.39;
203.222.177.40;
203.222.177.41;
203.222.177.42;
203.222.177.43;
203.222.177.44;
203.222.177.45;
203.222.177.46;
203.222.177.47;
203.222.177.48;
203.222.177.49;
203.222.177.50;
203.222.177.51;
203.222.177.52;
203.222.177.53;
203.222.177.54;
203.222.177.55;
203.222.177.56;
203.222.177.57;
203.222.177.58;
203.222.177.59;
203.222.177.60;
203.222.177.61;
203.222.177.62;
203.222.177.63;
203.222.177.64;
203.222.177.65;
203.222.177.66;
203.222.177.67;
203.222.177.68;
203.222.177.69;
203.222.177.70;
203.222.177.71;
203.222.182.152;
203.222.182.153;
203.222.182.154;
203.222.182.155;
203.222.182.156;
203.222.182.157;
203.222.182.158;
203.222.182.159;
203.222.187.176;
203.222.187.177;
203.222.187.178;
203.222.187.179;
203.222.187.180;
203.222.187.181;
203.222.187.182;
203.222.187.183;
206.73.60.96;
206.73.60.97;
206.73.60.98;
206.73.60.99;
206.73.60.100;
206.73.60.101;
206.73.60.102;
206.73.60.103;
206.73.60.104;
206.73.60.105;
206.73.60.106;
206.73.60.107;
206.73.60.108;
206.73.60.109;
206.73.60.110;
206.73.60.111;
206.73.60.112;
206.73.60.113;
206.73.60.114;
206.73.60.115;
206.73.60.116;
206.73.60.117;
206.73.60.118;
206.73.60.119;
206.73.60.120;
206.73.60.121;
206.73.60.122;
206.73.60.123;
206.73.60.124;
206.73.60.125;
206.73.60.126;
206.73.60.127;
206.73.91.32;
206.73.91.33;
206.73.91.34;
206.73.91.35;
206.73.91.36;
206.73.91.37;
206.73.91.38;
206.73.91.39;
206.73.91.40;
206.73.91.41;
206.73.91.42;
206.73.91.43;
206.73.91.44;
206.73.91.45;
206.73.91.46;
206.73.91.47;
206.73.91.48;
206.73.91.49;
206.73.91.50;
206.73.91.51;
206.73.91.52;
206.73.91.53;
206.73.91.54;
206.73.91.55;
206.73.91.56;
206.73.91.57;
206.73.91.58;
206.73.91.59;
206.73.91.60;
206.73.91.61;
206.73.91.62;
206.73.91.63;
206.73.227.64;
206.73.227.65;
206.73.227.66;
206.73.227.67;
206.73.227.68;
206.73.227.69;
206.73.227.70;
206.73.227.71;
206.73.227.72;
206.73.227.73;
206.73.227.74;
206.73.227.75;
206.73.227.76;
206.73.227.77;
206.73.227.78;
206.73.227.79;
206.73.227.80;
206.73.227.81;
206.73.227.82;
206.73.227.83;
206.73.227.84;
206.73.227.85;
206.73.227.86;
206.73.227.87;
206.73.227.88;
206.73.227.89;
206.73.227.90;
206.73.227.91;
206.73.227.92;
206.73.227.93;
206.73.227.94;
206.73.227.95;
206.73.227.96;
206.73.227.97;
206.73.227.98;
206.73.227.99;
206.73.227.100;
206.73.227.101;
206.73.227.102;
206.73.227.103;
206.73.227.104;
206.73.227.105;
206.73.227.106;
206.73.227.107;
206.73.227.108;
206.73.227.109;
206.73.227.110;
206.73.227.111;
206.73.227.112;
206.73.227.113;
206.73.227.114;
206.73.227.115;
206.73.227.116;
206.73.227.117;
206.73.227.118;
206.73.227.119;
206.73.227.120;
206.73.227.121;
206.73.227.122;
206.73.227.123;
206.73.227.124;
206.73.227.125;
206.73.227.126;
206.73.227.127;
206.182.200.128;
206.182.200.129;
206.182.200.130;
206.182.200.131;
206.182.200.132;
206.182.200.133;
206.182.200.134;
206.182.200.135;
206.182.200.136;
206.182.200.137;
206.182.200.138;
206.182.200.139;
206.182.200.140;
206.182.200.141;
206.182.200.142;
206.182.200.143;
206.182.200.144;
206.182.200.145;
206.182.200.146;
206.182.200.147;
206.182.200.148;
206.182.200.149;
206.182.200.150;
206.182.200.151;
206.182.200.152;
206.182.200.153;
206.182.200.154;
206.182.200.155;
206.182.200.156;
206.182.200.157;
206.182.200.158;
206.182.200.159;
206.182.200.160;
206.182.200.161;
206.182.200.162;
206.182.200.163;
206.182.200.164;
206.182.200.165;
206.182.200.166;
206.182.200.167;
206.182.200.168;
206.182.200.169;
206.182.200.170;
206.182.200.171;
206.182.200.172;
206.182.200.173;
206.182.200.174;
206.182.200.175;
206.182.200.176;
206.182.200.177;
206.182.200.178;
206.182.200.179;
206.182.200.180;
206.182.200.181;
206.182.200.182;
206.182.200.183;
206.182.200.184;
206.182.200.185;
206.182.200.186;
206.182.200.187;
206.182.200.188;
206.182.200.189;
206.182.200.190;
206.182.200.191;
209.50.243.8;
209.50.243.9;
209.50.243.10;
209.50.243.11;
209.50.243.12;
209.50.243.13;
209.50.243.14;
209.50.243.15;
209.93.194.64;
209.93.194.65;
209.93.194.66;
209.93.194.67;
209.93.194.68;
209.93.194.69;
209.93.194.70;
209.93.194.71;
209.93.194.72;
209.93.194.73;
209.93.194.74;
209.93.194.75;
209.93.194.76;
209.93.194.77;
209.93.194.78;
209.93.194.79;
209.93.194.80;
209.93.194.81;
209.93.194.82;
209.93.194.83;
209.93.194.84;
209.93.194.85;
209.93.194.86;
209.93.194.87;
209.93.194.88;
209.93.194.89;
209.93.194.90;
209.93.194.91;
209.93.194.92;
209.93.194.93;
209.93.194.94;
209.93.194.95;
209.93.194.96;
209.93.194.97;
209.93.194.98;
209.93.194.99;
209.93.194.100;
209.93.194.101;
209.93.194.102;
209.93.194.103;
209.93.194.104;
209.93.194.105;
209.93.194.106;
209.93.194.107;
209.93.194.108;
209.93.194.109;
209.93.194.110;
209.93.194.111;
209.93.194.112;
209.93.194.113;
209.93.194.114;
209.93.194.115;
209.93.194.116;
209.93.194.117;
209.93.194.118;
209.93.194.119;
209.93.194.120;
209.93.194.121;
209.93.194.122;
209.93.194.123;
209.93.194.124;
209.93.194.125;
209.93.194.126;
209.93.194.127;
210.31.210.0;
210.31.210.1;
210.31.210.2;
210.31.210.3;
212.63.183.216;
212.63.183.217;
212.63.183.218;
212.63.183.219;
212.184.11.112;
212.184.11.113;
212.184.11.114;
212.184.11.115;
212.184.11.116;
212.184.11.117;
212.184.11.118;
212.184.11.119;
58.14.0.0/10;
58.30.0.0/14;
58.66.0.0/15;
58.68.128.0/17;
58.82.0.0/15;
58.87.64.0/18;
58.99.128.0/13;
58.116.0.0/14;
58.128.0.0/13;
58.144.0.0/16;
58.154.0.0/15;
58.192.0.0/11;
58.240.0.0/12;
59.32.0.0/9;
59.107.0.0/13;
59.151.0.0/17;
59.155.0.0/16;
59.172.0.0/15;
59.191.0.0/17;
59.192.0.0/5;
60.55.0.0/16;
60.63.0.0/16;
60.160.0.0/11;
60.194.0.0/15;
60.200.0.0/11;
60.232.0.0/15;
60.235.0.0/16;
60.245.128.0/17;
60.247.0.0/16;
60.252.0.0/16;
60.253.128.0/17;
60.255.0.0/16;
61.8.160.0/20;
61.28.0.0/17;
61.29.128.0/17;
61.45.128.0/18;
61.47.128.0/18;
61.48.0.0/13;
61.87.192.0/18;
61.128.0.0/10;
61.161.0.0/16;
61.161.155.64/11;
61.232.0.0/13;
61.240.0.0/14;
121.0.16.0/19;
121.4.0.0/13;
121.8.0.0/10;
121.46.0.0/11;
121.51.0.0/16;
121.55.0.0/18;
121.56.0.0/13;
121.68.0.0/14;
121.76.0.0/15;
121.89.0.0/16;
121.100.128.0/17;
121.192.0.0/14;
121.201.0.0/16;
121.204.0.0/14;
121.224.0.0/12;
121.248.0.0/14;
121.255.0.0/16;
122.0.64.0/16;
122.4.0.0/12;
122.48.0.0/15;
122.51.0.0/16;
122.64.0.0/10;
122.102.0.0/19;
122.102.64.0/19;
122.192.0.0/14;
122.198.0.0/16;
122.200.64.0/18;
122.204.0.0/14;
122.224.0.0/11;
123.0.128.0/18;
123.4.0.0/12;
123.49.128.0/17;
123.52.0.0/14;
123.64.0.0/10;
123.99.128.0/17;
123.101.0.0/16;
123.199.128.0/17;
124.6.64.0/18;
124.16.0.0/14;
124.20.0.0/14;
124.29.0.0/17;
124.40.128.0/18;
124.42.0.0/17;
124.47.0.0/18;
124.64.0.0/14;
124.67.0.0/12;
124.88.0.0/13;
124.108.8.0/20;
124.108.40.0/21;
124.112.0.0/13;
124.128.0.0/13;
124.147.128.0/17;
124.156.0.0/16;
124.160.0.0/13;
124.172.0.0/14;
124.192.0.0/15;
124.196.0.0/16;
124.200.0.0/13;
124.220.0.0/10;
124.242.0.0/16;
124.243.192.0/18;
124.248.0.0/14;
124.254.0.0/18;
125.31.192.0/11;
125.58.128.0/17;
125.62.0.0/18;
125.64.0.0/10;
125.104.0.0/11;
125.171.0.0/16;
125.208.0.0/18;
125.210.0.0/16;
125.213.0.0/17;
125.215.0.0/18;
125.216.0.0/13;
125.254.128.0/18;
134.196.0.0/16;
147.243.224.0/19;
159.153.112.0/22;
159.153.120.0/22;
159.226.0.0/16;
161.207.0.0/16;
162.105.0.0/16;
166.111.0.0/16;
167.139.0.0/16;
168.160.0.0/16;
192.83.122.0/24;
192.124.154.0/24;
192.188.170.0/24;
198.17.7.0/24;
202.0.110.0/24;
202.4.128.0/19;
202.4.252.0/22;
202.8.128.0/19;
202.10.64.0/20;
202.14.88.0/24;
202.14.235.0/21;
202.20.120.0/24;
202.22.248.0/21;
202.38.0.0/19;
202.38.64.0/16;
202.38.140.0/22;
202.38.146.0/23;
202.38.149.0/22;
202.38.152.0/21;
202.38.158.0/18;
202.38.164.0/19;
202.38.184.0/17;
202.41.142.0/24;
202.41.152.0/21;
202.41.240.0/20;
202.43.144.0/20;
202.46.32.0/19;
202.46.224.0/20;
202.60.112.0/20;
202.63.248.0/22;
202.69.4.0/20;
202.69.16.0/19;
202.70.0.0/18;
202.70.160.0/20;
202.74.8.0/20;
202.75.208.0/20;
202.85.208.0/20;
202.90.0.0/20;
202.90.224.0/20;
202.90.252.0/15;
202.91.128.0/22;
202.91.176.0/20;
202.91.224.0/13;
202.92.252.0/15;
202.93.252.0/14;
202.95.0.0/18;
202.95.252.0/10;
202.122.32.0/21;
202.122.64.0/19;
202.122.112.0/21;
202.122.128.0/24;
202.123.96.0/20;
202.125.176.0/20;
202.127.0.0/19;
202.127.12.0/18;
202.127.40.0/19;
202.127.112.0/16;
202.127.192.0/18;
202.130.0.0/18;
202.130.224.0/19;
202.131.16.0/20;
202.131.48.0/20;
202.131.208.0/20;
202.136.48.0/20;
202.136.208.0/18;
202.136.254.0/23;
202.141.160.0/19;
202.142.16.0/19;
202.143.16.0/19;
202.148.96.0/19;
202.149.160.0/19;
202.149.224.0/19;
202.150.16.0/19;
202.152.176.0/20;
202.153.48.0/20;
202.158.160.0/19;
202.160.176.0/20;
202.164.0.0/19;
202.165.96.0/20;
202.165.176.0/20;
202.165.208.0/20;
202.168.160.0/19;
202.170.128.0/19;
202.170.216.0/21;
202.173.8.0/20;
202.173.224.0/19;
202.176.224.0/19;
202.179.240.0/20;
202.180.128.0/19;
202.181.112.0/20;
202.189.80.0/20;
202.192.0.0/12;
203.79.0.0/19;
203.80.144.0/20;
203.81.16.0/19;
203.83.56.0/21;
203.86.0.0/17;
203.88.32.0/19;
203.88.192.0/19;
203.89.0.0/20;
203.90.0.0/20;
203.90.128.0/17;
203.91.32.0/19;
203.91.96.0/20;
203.91.120.0/21;
203.92.0.0/20;
203.92.160.0/19;
203.93.0.0/14;
203.95.0.0/19;
203.95.96.0/19;
203.99.16.0/19;
203.99.80.0/20;
203.100.32.0/20;
203.100.80.0/18;
203.100.192.0/20;
203.110.160.0/19;
203.118.192.0/19;
203.119.24.0/19;
203.128.32.0/19;
203.128.96.0/19;
203.130.32.0/19;
203.132.32.0/19;
203.134.240.0/21;
203.135.96.0/19;
203.135.160.0/20;
203.148.0.0/18;
203.152.64.0/19;
203.156.192.0/18;
203.158.16.0/20;
203.161.192.0/19;
203.166.160.0/19;
203.171.224.0/20;
203.174.96.0/19;
203.175.128.0/19;
203.175.192.0/18;
203.176.168.0/21;
203.184.80.0/20;
203.187.160.0/19;
203.190.96.0/20;
203.191.16.0/19;
203.191.64.0/18;
203.191.144.0/20;
203.192.0.0/18;
203.196.0.0/19;
203.207.64.0/11;
203.208.32.0/19;
203.209.224.0/19;
203.212.0.0/19;
203.212.80.0/20;
203.222.166.192/26;
203.222.176.248/29;
207.117.165.0/24;
207.209.206.128/25;
208.18.90.0/24;
210.5.0.0/18;
210.5.128.0/19;
210.12.0.0/14;
210.14.64.0/19;
210.14.128.0/14;
210.16.128.0/18;
210.21.0.0/13;
210.23.32.0/19;
210.31.210.8/11;
210.51.0.0/13;
210.56.192.0/19;
210.72.0.0/13;
210.79.64.0/18;
210.79.224.0/19;
210.82.0.0/15;
210.87.128.0/18;
210.185.192.0/18;
210.192.96.0/19;
210.25.0.0/12;
210.31.0.0/16;
211.64.0.0/13;
211.80.0.0/10;
211.136.0.0/10;
217.8.101.0/24;
218.0.0.0/10;
218.56.0.0/9;
218.104.0.0/13;
218.185.192.0/19;
218.192.0.0/12;
218.240.0.0/13;
218.249.0.0/16;
219.72.0.0/16;
219.82.0.0/16;
219.128.0.0/11;
219.216.0.0/10;
219.242.0.0/13;
220.101.192.0/18;
220.112.0.0/14;
220.152.128.0/17;
220.154.0.0/15;
220.160.0.0/9;
220.231.0.0/18;
220.231.128.0/17;
220.232.64.0/18;
220.234.0.0/16;
220.242.0.0/15;
220.248.0.0/13;
221.0.0.0/11;
221.13.0.0/13;
221.122.0.0/15;
221.129.0.0/14;
221.133.224.0/19;
221.136.0.0/15;
221.172.0.0/11;
221.192.0.0/13;
221.199.224.0/10;
222.16.0.0/9;
222.125.0.0/16;
222.126.128.0/17;
222.128.0.0/12;
222.160.0.0/14;
222.168.0.0/9;
222.240.0.0/12;
};

附二:一般網絡上找到的IP段都是192.168.0.0-192.168.255.255這種格式,必須要改成BIND支持的,如下代碼可轉換

 

<?php


//$h=fopen("ip.txt","r");

$h=file_get_contents("ip.txt");


$ipList=split(" ",$h);

for($i=0;$i<count($ipList);$i++)
{
   
echo  duibi($ipList[$i]);
   
echo ";";
   
echo " ";
}

function duibi($ip
{
    
list($oneip,$twoip)=split("-",$ip);

    
$one=zhuanfuna($oneip);
    
$two=zhuanfuna($twoip);
    
    
$oneList=explode(".",$one);
    
$twoList=explode(".",$two);

    
$place=0;

    
for($i=0;$i<4;$i++)
    {
        
if($oneList[$i]!=$twoList[$i])
        {
            
$place=$i*8;

            
for($k=0;$k<8;$k++)
            {
                
if(substr($oneList[$i],$k,1)!=substr($twoList[$i],$k,1))
                {  
                    
$place+=$k;

                    
break;
                }
            }
           
break;
            
        }
    }
    
return trim($oneip)."/".$place;



function zhuanfuna($num)
{
   
$binAddressList=explode(".",$num);

   
$binAddress="";

   
for($i=0;$i<count($binAddressList);$i++)
   {
     
$duan=decbin($binAddressList[$i]);

     
if(strlen($duan)<8)
     {
         
for($j=0;$j<=(8-strlen($duan));$j++)
         {
             
$duan="0".$duan;
         }
     }
     
if($i!=3)
       {
$binAddress.=$duan.".";}
     
else
     {
          
$binAddress.=$duan;
     }
   }
   
return $binAddress;
}

//a("209.93.194.64 - 209.93.194.127");

function a($ip)
{
    
list($one,$two)=split("-",$ip);

    
$onel=explode(".",$one);
    
$twol=explode(".",$two);

    
$c=$twol[3]-$onel[3];

    
$ip=$onel[0].".".$onel[1].".".$onel[2];

    
for($i=0;$i<=$c;$i++)
    {
      
echo $ip.".".($onel[3]+$i); 
      
echo " ";
    }

?>

注意:

1.如果解析要在廣域網上使用,域名服務器必需通過NIC部門註冊.然後做服務器名稱的A記錄.

2.解析後不會馬上生效,必須要各DNS服務器更新列表.一般24-48小時可生效,可用下面的方式查詢.

  nslookup 202.101.107.55(可換成各地區的DNS)來測試..

 3.所有的ZONE都必須放在VIEW裏面..

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章