Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Perl - Cisco VLAN Removal

DZone's Guide to

Perl - Cisco VLAN Removal

·
Free Resource
// Perl - Cisco VLAN Removal
// new.txt format 
// ipaddress|loginpass|enablepass|gigabitEthernet3/48|20


#!c:/perl/bin/perl.exe

use Net::Telnet::Cisco;

open(CISCO,'new.txt');
 while (
  
   ) {
 chomp;
my @fields = split(/\|/, $_);

my $host = $fields[0];
my $login = $fields[1];
my $telnet = $fields[2];
my $interface = $fields[3];
my $vlan = $fields[4];

#print "Content-type:text/html\n\n";
#print "Switch = 
   $host    
   
"; #print "Command = username $macaddr password $macaddr
"; $session = Net::Telnet::Cisco->new(Host => "$host", Input_log => "input.log"); $session->login(Password => "$login"); $session->enable("$telnet"); $session->cmd("config t"); $session->cmd("int $interface"); $session->cmd("no switchport access vlan $vlan"); $session->cmd("no switchport mode access"); $session->cmd("exit"); $session->close(); }
Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}