#!/usr/bin/perl use strict; use warnings; use SNMP; my $hostname = 'localhost'; my $port = 161, my $community = 'public'; $SNMP::verbose = 1; $SNMP::debugging = 1; $SNMP::dump_packet = 1; my $session = new SNMP::Session( 'DestHost' => $hostname, 'Community' => $community, 'RemotePort' => $port, 'UseSprintValue' => 1 ); die "session creation error: Can't fire-up!\n" unless (defined $session); my $vars = new SNMP::VarList(['ipNetToMediaNetAddress'], ['ipNetToMediaPhysAddress']); my ($ip,$mac) = $session->getnext($vars); die $session->{ErrorStr} if ($session->{ErrorStr}); while (!$session->{ErrorStr} and $$vars[0]->tag eq "ipNetToMediaNetAddress") { print "$ip -> $mac\n"; }; ($ip,$mac) = $session->getnext($vars);