Making Interface Table Numbers Permanent

Problem

You want to ensure that your router uses the same SNMP interface numbers every time it reboots.

Solution

To ensure that SNMP interface numbers remain permanent after a router power cycle, use the following command. This is a global command that affects all interfaces:

Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#snmp-server ifindex persist
Router(config)#end
Router#

You can also fix the SNMP interface number of a single interface as follows:

Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#interface Serial0/0
Router(config-if)#snmp ifindex persist
Router(config-if)#exit
Router(config)#end
Router#

This command is available in IOS Versions 12.1(5)T and above.

Discussion

Most engineers do not understand that the internal SNMP interface numbers assigned by the router are not stable. That is, the SNMP interface numbers are prone to change after router reboot, especially if you add or remove logical interfaces (i.e., subinterfaces) or physical modules.

This issue has plagued many administrators and software vendors for years. The problem is that most network performance software packages poll for interface data by using the unique interface number assigned by the router. However, if these numbers change after a router reboots, then the performance data becomes meaningless, since there is no guarantee that you are still polling the same interface. Most high-end SNMP performance software companies have built "fixes" to circumvent this exact issue.

Changing interface numbers particularly affects the router's built-in RMON monitoring. With RMON, you can configure the router to monitor its own MIB values and assign threshold values in which to send notifications. Unfortunately, before the new functionality shown in this recipe came along, RMON polling was not reliable for interface specific statistics. RMON services are discussed in detail in Recipe 17.23.

There are some minor costs to using this feature. First, each interface number requires 25 bytes of NVRAM to store. Second, some administrators have reported slightly slower boot times on routers that employ this feature. Otherwise, this new functionality is mostly transparent to the network administrator.

To illustrate the ifindex stability problem, consider the interface numbers on a typical router:

Freebsd% snmpwalk v1 -c ORARO Router ifDescr
interfaces.ifTable.ifEntry.ifDescr.1 = "BRI0/0"
interfaces.ifTable.ifEntry.ifDescr.2 = "Ethernet0/0"
interfaces.ifTable.ifEntry.ifDescr.3 = "BRI0/0:1"
interfaces.ifTable.ifEntry.ifDescr.4 = "BRI0/0:2"
interfaces.ifTable.ifEntry.ifDescr.5 = "FastEthernet1/0"
interfaces.ifTable.ifEntry.ifDescr.6 = "Null0"
interfaces.ifTable.ifEntry.ifDescr.7 = "Loopback0"

Notice that the router assigns a unique number to each interface, starting with one. In this example, the interface FastEthernet1/0 has an ifindex value of 5. This is the number you would use in SNMP polls for various interface level performance statistics. Next, we will power-down the router and remove the BRI module before restoring power:

Freebsd% snmpwalk v1 -c ORARO Router ifDescr
interfaces.ifTable.ifEntry.ifDescr.1 = "Ethernet0/0"
interfaces.ifTable.ifEntry.ifDescr.2 = "FastEthernet1/0"
interfaces.ifTable.ifEntry.ifDescr.3 = "Null0"
interfaces.ifTable.ifEntry.ifDescr.4 = "Loopback0"

Notice that the BRI interface entries are gone and the remaining interface numbers have completely changed. The FastEthernet1/0 interface now appears as interface number two. And, worse still, there is no interface number 5 at all. So if you had been doing performance analysis on this port, it would suddenly stop working.

Returning the router to its original state restores the original interface numbers:

Freebsd% snmpwalk v1 -c ORARO Router ifDescr
interfaces.ifTable.ifEntry.ifDescr.1 = "BRI0/0"
interfaces.ifTable.ifEntry.ifDescr.2 = "Ethernet0/0"
interfaces.ifTable.ifEntry.ifDescr.3 = "BRI0/0:1"
interfaces.ifTable.ifEntry.ifDescr.4 = "BRI0/0:2"
interfaces.ifTable.ifEntry.ifDescr.5 = "FastEthernet1/0"
interfaces.ifTable.ifEntry.ifDescr.6 = "Null0"
interfaces.ifTable.ifEntry.ifDescr.7 = "Loopback0"

However, if we enable the snmp ifindex persist command before powering down the router and removing the BRI module, the only difference is that the three entries associated with the BRI interface are removed:

Freebsd% snmpwalk v1 -c ORARO 172.25.1.8 ifDescr
interfaces.ifTable.ifEntry.ifDescr.2 = "Ethernet0/0"
interfaces.ifTable.ifEntry.ifDescr.5 = "FastEthernet1/0"
interfaces.ifTable.ifEntry.ifDescr.6 = "Null0"
interfaces.ifTable.ifEntry.ifDescr.7 = "Loopback0"

The remaining interfaces have retained their original interface numbers after the router reboot. In particular, the FastEthernet1/0 interface is once again interface number 5, which means that all polled data will still be useful.

See Also

Recipe 17.23

Router Configuration and File Management

Router Management

User Access and Privilege Levels

TACACS+

IP Routing

RIP

EIGRP

OSPF

BGP

Frame Relay

Handling Queuing and Congestion

Tunnels and VPNs

Dial Backup

NTP and Time

DLSw

Router Interfaces and Media

Simple Network Management Protocol

Logging

Access-Lists

DHCP

NAT

First Hop Redundancy Protocols

IP Multicast

IP Mobility

IPv6

MPLS

Security

Appendix 1. External Software Packages

Appendix 2. IP Precedence, TOS, and DSCP Classifications

Index



Cisco IOS Cookbook
Cisco IOS Cookbook (Cookbooks (OReilly))
ISBN: 0596527225
EAN: 2147483647
Year: 2004
Pages: 505

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net