Re: Get interface IPV6 addresses

Niels Baggesen <[email protected]>
Newsgroups gmane.network.net-snmp.devel
Message-ID <[email protected]>
Den 27-02-2020 kl. 18:40 skrev Michael Wu:
> Dear Net-Snmp coders:
> 
> I am using net-snmp v5.8 with ipv6 enabled. Trying to get interface's 
> ipv6 addresses. I tried a couple of oids but could not figure out how to 
> map the ifindex to the ipv6 address assigned to the interfaces. All 
> interfaces have both ipv4 and ipv6 addresses assigned.

What OS is this? Is this your own compilation from the release tar ball 
or the versions provided by your distribution?

> 1. The ipv6AddrPrefixTable documented in 
> http://www.net-snmp.org/docs/mibs/ipv6MIB.html 
> <http://www.net-snmp.org/docs/mibs/ipv6MIB.html> was not available:
> 
> snmpwalk -v 2c -c public x.x.x.x .1.3.6.1.2.1.55.1.7
> IPV6-MIB::ipv6AddrPrefixTable = No Such Object available on this agent 
> at this OID

No, the IPV6-MIB has been deprecated in favor of the augmented IP-MIB 
(as used below)

> 2. ipAddressTable (1.3.6.1.2.1.4.34) has entries of ipv6 prefix:
> 
> snmpwalk -v 2c -c public x.x.x.x .1.3.6.1.2.1.4.34
> IP-MIB::ipAddressIfIndex.ipv4."243.0.3.129" = INTEGER: 230
> IP-MIB::ipAddressIfIndex.ipv6."fe:80:00:00:00:00:00:00:02:e0:ec:ff:fe:e1:5e:44" 
> = INTEGER: 230
> IP-MIB::ipAddressType.ipv4."243.0.3.129" = INTEGER: unicast(1)
> IP-MIB::ipAddressType.ipv6."fe:80:00:00:00:00:00:00:02:e0:ec:ff:fe:e1:5e:44" 
> = INTEGER: unicast(1)
> ...
> But I don't see ipAddressPrefix ( .1.3.6.1.2.1.4.34.5) from the output.

I do, with the CentOS 7 provided version (5.7.2), and with a somewhat 
recent installation of the 5-8-patches branch.

IP-MIB::ipAddressPrefix.ipv6."00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:01" 
= OID: 
IP-MIB::ipAddressPrefixOrigin.1.ipv6."00:00:00:00:00:00:00:00:00:00:00:00: 
                                          00:00:00:01".128
IP-MIB::ipAddressPrefix.ipv6."20:01:04:70:df:9a:00:00:00:00:00:00:00:00:00:01" 
=                                           OID: 
IP-MIB::ipAddressPrefixOrigin.2.ipv6."20:01:04:70:df:9a:00:00:00:00:00:00: 
                                          00:00:00:00".64
IP-MIB::ipAddressPrefix.ipv6."fe:80:00:00:00:00:00:00:de:98:3e:20:92:51:bd:11" 
=                                           OID: 
IP-MIB::ipAddressPrefixOrigin.2.ipv6."fe:80:00:00:00:00:00:00:00:00:00:00: 
                                          00:00:00:00".64


> 3. Also tried ipAdEntIfIndex ( 1.3.6.1.2.1.4.20.1.2)
> 
> snmpwalk -v 2c -c public x.x.x.x 1.3.6.1.2.1.4.20.1.2
> ...
> IP-MIB::ipAdEntIfIndex.243.0.3.129 = INTEGER: 230
> ...
> But it only has ipv4 addresses.

Yes, this is a IPv4 only table.

> What is the right approach to get the ipv6 address from the interface?

I would look at
IP-MIB::ipAddressIfIndex.ipv6."00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:01" 
= INTEGER: 1
IP-MIB::ipAddressIfIndex.ipv6."20:01:04:70:df:9a:00:00:00:00:00:00:00:00:00:01" 
= INTEGER: 2

/Niels

PS: Sorry about the line wrap of these extreme OIDs :-(

-- 
<https://www.e-julemaerket.dk/?f78133c1-061f-4320-b728-d1dbbf6996c7>



_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.