Perlfect Solutions
 

[Perlfect-search] Telnet and IPMAC

Attiah, Ibrahim A perlfect-search@perlfect.com
Sat, 09 Nov 2002 13:39:52 +0300
One of the activities that I periodically need to do is accessing about 12 network switches and list the active IP address, MAC address and the port number (which each workstation is connected to in the switch).
 
I used to do this from CMD as follow:
>TelNet "switch Name or IP address"
Enter the Login ID + password
Then through the following commands I got what I want  
Networking/ IP % IPMAC
 
IP Address         MAC Address     Slot / Int
xx.xxx. 13.  2     00065B:A7B250     5 / 20
xx. xxx. 13.  9     00C04F:56A16D     4 / 21
xx. xxx. 13. 10     00C04F:4E2557     4 / 8
xx. xxx. 13. 12     00065B:A8405F     4 / 24
xx. xxx. 13.116     00C04F:24D92D     5 / 16
 
To automate the previous process, I am implementing the following PERL code which work fine. 
use Net::Telnet;
  $telnet = new Net::Telnet ( Timeout=>10, Errmode=>'die');
  $telnet->open('switch Name or IP address');
  $telnet->login('Login Id', 'Password');
  
How can I complete this code to get the same required data?
 
Thank you.