On Fri, Oct 15, 2004 at 10:48:28AM +0000, Rio Martin. wrote: > Folks, > I need to know how to limit access to some number from bulk random users. > Let say, i have 256 PCs connecting to Internet daily. > I want to limit my users accessing to Internet only for 100 users during peak > time. But these 100users must be selected in random. > > Need a fresh idea how to do that with iptables. Should i apply special > patches? iptables -N random iptables -A FORWARD -j random --- BEGIN PERL CODE TO GENERATE LIST OF 100 RANDOM IPs --- #!/usr/bin/perl use strict; my %ips = (); my $ip; my $randomIP; while ( scalar(keys(%ips)) < 100) { $randomIP = int( rand(254)) + 1; if ( exists($ips{$randomIP}) ) { next; } else { $ips{$randomIP} = $randomIP; } } foreach $ip (sort {$a <=> $b} keys %ips) { print "$ip\n"; } --- END PERL CODE --- iptables -F random for i in `./random_ips.pl`; do iptables -A random -s 192.168.1.${i} -j ACCEPT done -j -- Jason Opperisano <opie@xxxxxxxxxxx>