Thanks for the script Paul, might have look into the software and IP2location for the windows based machines, and script for linux.

 

James

 


From: Barry Murphy [mailto:barry@unix.co.nz]
Sent: Thursday, 30 June 2005 9:30 a.m.
To: James J. Guidera; NZNOG@list.waikato.ac.nz
Subject: Re: [nznog] NZ IP-Range

 

I got this script from Paul of linuxsystems, grabs the APNIC IP database and compiles a list of NZ ip ranges:

 

#!/usr/local/bin/php
<?php

 

$in_file = "ftp://ftp.apnic.net/pub/apnic/dbase/data/country-ipv4.lst";
// $in_file = "country-ipv4.lst";
$out_file = "nzipranges.txt";

 

$handle_input = @fopen($in_file,"r") or die("Unable to open $in_file\n\n");

 

$handle_output = fopen($out_file, "w");

 

$now = date ("r");

 

fwrite ($handle_output,"# Generated: $now\n\n");

 

while (!feof($handle_input)) {
   $buffer = fgets($handle_input);
   if ( ereg ( "nz", $buffer) ) {
     // echo $buffer;
     $this_range = trim(preg_replace ( "#([\d\.]+) \- [\d\.]+ : [\d\.]+(\/\d+) .+#","$1$2", $buffer ));
     fwrite ($handle_output,"\n" . $this_range);
   }
}
fclose($handle_input);

 

fwrite ($handle_output,"\n");
fclose($handle_output);

 


?>

----- Original Message -----

From: James J. Guidera

To: NZNOG@list.waikato.ac.nz

Sent: Thursday, June 30, 2005 9:00 AM

Subject: [nznog] NZ IP-Range

 

Just a quick question,

 

Is there a singular complete list of NZ ip range?? I am wanting to allow only NZ traffic access to servers.

 

Thanks

James Guidera

Systems Engineer

Miracle Electronics Ltd

Ph:+64-4-385-1293

Cel: +64-21-705-614

 


_______________________________________________
NZNOG mailing list
NZNOG@list.waikato.ac.nz
http://list.waikato.ac.nz/mailman/listinfo/nznog