[c-nsp] IOS/6500 SNMP to detect IPv6 address on a VLAN

Peter Rathlev peter at rathlev.dk
Wed Sep 28 15:44:25 EDT 2016


On Wed, 2016-09-28 at 13:21 +0000, Drew Weaver wrote:
> I'm trying to programmatically detect whether or not there is already
> an IPv6 address assigned to an SVI/VLAN on a Cat 6500 (IOS).
> 
> Obviously, I can write a snippet that does show run int vlan X and
> parse that, but a more elegant way would be to use SNMP with the
> @vlanID in the community. Is anyone aware of whether or not there are
> any OIDs that show either IF there is an IPv6 address assigned to a
> VLAN or what IPv6 address is assigned to a VLAN?

You could use e.g. IP-MIB::ipAddressIfIndex. On a Sup2T 15.1(2)SY6:

interface Vlan1500
 vrf forwarding EXAMPLE
 no ip address
 ipv6 address 2001:DB8::1/64
 ipv6 address 2001:DB8::666:1/64
!

$ snmpbulkwalk -v2c -casdf swouter-1 IP-MIB::ipAddressIfIndex
IP-MIB::ipAddressIfIndex.ipv6z."20:01:0d:b8:00:00:00:00:00:00:00:00:00:00:00:01%503316486" = INTEGER: 3029
IP-MIB::ipAddressIfIndex.ipv6z."20:01:0d:b8:00:00:00:00:00:00:00:00:06:66:00:01%503316486" = INTEGER: 3029
IP-MIB::ipAddressIfIndex.ipv6z."fe:80:00:00:00:00:00:00:02:25:84:ff:fe:44:e3:00%301990418" = INTEGER: 3029
$ snmpget -v2c -casdf swouter-1 IF-MIB::ifDescr.3029
IF-MIB::ifDescr.3029 = STRING: Vlan1500

If you're only interested in wether IPv6 is already enabled for a given
interface you can query IP-MIB::ipv6InterfaceEnableStatus directly. It
returns "up(1)" if at least one IPv6 address has been configured.
Otherwise it's "No Such Instance currently exists at this OID" (at
least on this IOS version).

There's no need for a community context, that's only for the switching
parts like BRIDGE-MIB.

-- 
Peter



More information about the cisco-nsp mailing list