From: loke (loke14@gmail.com)
Date: Fri Jan 13 2006 - 20:39:57 GMT-3
Im interested in why you guys want random routes?
Nick
On 1/13/06, Bajo <bajoalex@gmail.com> wrote:
>
> Here we go Mike courtesy of the authors and my gmail search :)
> Henk de Tombe <henk.de.tombe@qi.nl>to Leigh, FORUM, brian.helterli.
> More options 10/25/05 Hi Leigh,
>
> The routes are too random :-)
>
> Have a look at this:
>
> C:\Temp>perl routes.pl 5
> ip route 11.20.96.117 255.255.255.255 null 0
> ip route 102.46.177.226 254.0.0.0 null 0
> ip route 195.179.28.84 255.192.0.0 null 0
> ip route 59.201.225.158 255.255.255.255 null 0
> ip route 145.210.182.174 255.192.0.0 null 0
>
>
> Just two routes out of five are "usefull". The network portion always
> fills
> 4 octets, the subnetmask is random. I altered the scripts to generate /16,
> /24 or /32 routes.
>
> Anyway, thank you very much for sharing this script!
>
> *****************************
> ******* /16 routes **********
> *****************************
>
> use strict;
> use warnings;
>
> #ip route 1.2.3.0 255.255.255.0 null 0
>
>
> my @netmask1 = qw / 255 /;
> my @netmask2 = qw/ 255 /;
>
>
> my $count = shift or Usage();
>
> while ( $count-- > 0 ) {
> my @ip = ( int(rand(223))+1, # 1 to 223
> int(rand(256)), # 0 to 255
> int(rand(0)), # 0 to 255
> int(rand(0)) # 0 to 255
> );
> my @mask = ( 0, 0, 0, 0 );
> $mask[0] = $netmask1[ int(rand(@netmask1)) ];
> if ( $mask[0] == 255 ) {
> foreach my $idx ( 1..1 ) {
> $mask[$idx] = $netmask2[ int(rand(@netmask2)) ];
> last unless $mask[$idx] == 255;
> }
> }
>
> print "ip route ", join( ".", @ip), " ", join( ".", @mask), " null
> 0\n";
> }
>
>
> sub Usage {
> print "$0 <number of ip addresses to generate>\n";
> exit;
> }
>
>
> *****************************
> ******* /24 routes **********
> *****************************
>
>
> use strict;
> use warnings;
>
> #ip route 1.2.3.0 255.255.255.0 null 0
>
>
> my @netmask1 = qw / 255 /;
> my @netmask2 = qw/ 255 /;
>
>
> my $count = shift or Usage();
>
> while ( $count-- > 0 ) {
> my @ip = ( int(rand(223))+1, # 1 to 223
> int(rand(256)), # 0 to 255
> int(rand(256)), # 0 to 255
> int(rand(0)) # 0 to 255
> );
> my @mask = ( 0, 0, 0, 0 );
> $mask[0] = $netmask1[ int(rand(@netmask1)) ];
> if ( $mask[0] == 255 ) {
> foreach my $idx ( 1..2 ) {
> $mask[$idx] = $netmask2[ int(rand(@netmask2)) ];
> last unless $mask[$idx] == 255;
> }
> }
>
> print "ip route ", join( ".", @ip), " ", join( ".", @mask), " null
> 0\n";
> }
>
>
> sub Usage {
> print "$0 <number of ip addresses to generate>\n";
> exit;
> }
>
>
> *****************************
> ******* /32 routes **********
> *****************************
>
>
> use strict;
> use warnings;
>
> #ip route 1.2.3.0 255.255.255.0 null 0
>
>
> my @netmask1 = qw / 255 /;
> my @netmask2 = qw/ 255 /;
>
>
> my $count = shift or Usage();
>
> while ( $count-- > 0 ) {
> my @ip = ( int(rand(223))+1, # 1 to 223
> int(rand(256)), # 0 to 255
> int(rand(256)), # 0 to 255
> int(rand(256)) # 0 to 255
> );
> my @mask = ( 0, 0, 0, 0 );
> $mask[0] = $netmask1[ int(rand(@netmask1)) ];
> if ( $mask[0] == 255 ) {
> foreach my $idx ( 1..3 ) {
> $mask[$idx] = $netmask2[ int(rand(@netmask2)) ];
> last unless $mask[$idx] == 255;
> }
> }
>
> print "ip route ", join( ".", @ip), " ", join( ".", @mask), " null
> 0\n";
> }
>
>
> sub Usage {
> print "$0 <number of ip addresses to generate>\n";
> exit;
> }
>
>
> Regards,
> Henk
>
>
> -----Oorspronkelijk bericht-----
> Van: nobody@groupstudy.com [mailto:nobody@groupstudy.com] Namens Leigh
> Harrison
> Verzonden: dinsdag 18 oktober 2005 00:17
> Aan: FORUM; brian.helterline@hp.com
> Onderwerp: Perl Script for Random Routes
>
> All,
>
> Spurred on by Kevins posting of loads of routes - I posted a request on a
> perl newsgroup for someone to knock me up a perl script to do it.
> Within 45 mins a thoroughly decent chap named Brian Helterline had
> answered
> my plea.
>
> Run the script and put in how many routes you would like the script to
> create and it will fire them out for you, i.e., c:\> perl routescript 50
>
> and 50 routes will fly up the screen ready to be cut and paste (if you're
> running linux you can always send them to a file)
>
> Brian,
>
> I altered the script a tiny bit, so I could get a more weighted random
> number for the network masks - hope you don't mind!!
>
> Once again - many thanks for you effort on this - I'm sure it will be very
> useful to a great many people.
>
> LH
>
>
> -------------------------------------------
>
> use strict;
> use warnings;
>
> #ip route 1.2.3.0 <http://1.2.3.0> 255.255.255.0 < http://255.255.255.0>
> null
> 0
>
>
> my @netmask1 = qw / 128 192 224 240 248 252 254 255 255 255 255 255 255
> 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
> 255 /;
> my @netmask2 = qw/ 0 128 192 224 240 248 252 254 255 255 255 255 255 255
> 255 255 255 255 255 255 255 255 255 255 255 255 /;
>
>
> my $count = shift or Usage();
>
> while ( $count-- > 0 ) {
> my @ip = ( int(rand(223))+1, # 1 to 223
> int(rand(256)), # 0 to 255
> int(rand(256)), # 0 to 255
> int(rand(256)) # 0 to 255
> );
> my @mask = ( 0, 0, 0, 0 );
> $mask[0] = $netmask1[ int(rand(@netmask1)) ];
> if ( $mask[0] == 255 ) {
> foreach my $idx ( 1..3 ) {
> $mask[$idx] = $netmask2[ int(rand(@netmask2)) ];
> last unless $mask[$idx] == 255;
> }
> }
>
> print "ip route ", join( ".", @ip), " ", join( ".", @mask), "
> null 0\n";
> }
>
>
> sub Usage {
> print "$0 <number of ip addresses to generate>\n";
> exit;
> }
>
> -------------------------------------------
>
>
>
>
> On 1/13/06, Mike O <mikeeo@msn.com> wrote:
> >
> > Would anyone mind re-posting the 500+ routes email. I forget who created
> > and
> > also I think someone created a perl script that created random routes
> and
> > I
> > can't seem to find it in the archives.
> >
> > Thanks
> >
> > _______________________________________________________________________
> > Subscription information may be found at:
> > http://www.groupstudy.com/list/CCIELab.html
> >
>
>
>
> --
> Kind Regards,
>
> Bajo
>
> _______________________________________________________________________
> Subscription information may be found at:
> http://www.groupstudy.com/list/CCIELab.html
This archive was generated by hypermail 2.1.4 : Wed Feb 01 2006 - 07:45:49 GMT-3