Any one have any experience with adding nat statements to a cisco with Perl?
I'm writing a script to do that from a db run by cron and using Net::Telnet::Cisco (which I have yet to install and experiement with) I just want to make sure I'm doing this right or if there's a better way or ??: ################### for(@{$dbh->selectall_arraryref($qry)}) { # do query to mark record as checked so $qry won't get this record again next time around # If it can't be done add that fact to $r so that whoever $r gets emailed to will know to look into it my $cmd; my($cip,$priprt,$pubport,$proto,$inip,$soip) = @{$_}; if($priprt =~ m/^\d+$/ && $pubprt =~ m/^\d+$/) { if($proto !~ m/^tcp$ && $proto !~ m/^udp$) { $proto = 'tcp'; } $cmd = "ip nat inside source static $proto $inip $priprt $soip $pubprt extendable"; } else { $cmd = "ip nat inside source static $inip $soip"; } $r .= "Going to Login and Enable and run -$cmd-\n"; my $ses = Net::Telnet::Cisco->new(Host => $cip); if($ses) { if($ses->login($lgn{$cip}{'usr'}, $lgn{$cip}{'pss'})) { if($ses->enable($lgn{$cip}{'enb'})) { $r .= "\tEntering Configure terminal: "; $r .= join('',$ses->cmd('configure terminal')); $r .= "\n\tEntering command: "; $r .= join('',$ses->cmd($cmd)); $r .= "\n\tLeaving Configure: "; $r .= join('',$ses->cmd('exit')); $r .= "\n\tWriting Memory: "; $r .= join('',$ses->cmd('write memory')); $ses->disable; } else { $r .= "Can not enable: " . $ses->errmsg; } } else { $r .= "Can not login: " . $ses->errmsg; } $ses->close; } else { $r .= "Could not create initial session object to -$cip-\n"; } $r .= "\n"; } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]