11-30-2019 09:47 AM
I am certain I should know this already but I seem to be very stuck at the moment!
I need to figure out a way to check when all routes are lost on a particular interface. CLI commands or SNMP checks would work. I know I can check for a BGP neighbor or an OSPF neighbor or EIGRP neighbor but those are all by defined neighbor and sometimes we have multiple neighbors off a single interface. I would like this check to be portable and not depend on a particular routing protocol or particular route.
Any ideas?
Solved! Go to Solution.
11-30-2019 03:22 PM
I did some research and found a script using SNMP.
http://it-certification-network.blogspot.com/2008/12/generating-report-of-routing-table.html
That looks like a good base to start.
11-30-2019 11:41 AM
I am not sure that there is a way to accomplish what you want without some resort to specific protocol. When I read your post my first thought was that you might use something like
show ip route | include FastEthernet0/1
which would show all routes learned on that interface and check to see if there was no output. But the issue is that you might have lost all the learned routes (which is what you are interested in) but still have the connected subnet show up.
So my next thought was to use something like
show ip route eigrp | include FastEthernet0/1
which would show routes leaned via eigrp on that interface. If there is no output then you know you have lost all learned routes on that interface. It does have a protocol dependency, which you would like to avoid. But I can not think of any other way to achieve what you want.
HTH
Rick
11-30-2019 11:48 AM
While your solution would work on eigrp, it does not work at all on BGP. show ip route bgp does not provide interface information, nor does show ip bgp topology.
I guess this was harder than I thought. Maybe an snmpget for an interface perhaps?
11-30-2019 01:45 PM
I was not aware of that aspect of show ip route bgp. But given this I agree that my suggestion is flawed. I do not know of any simple command that will give you what you want and I am not clear that there is any snmpget for interface information that would do it.
If you would consider alternatives that are based on scripting then I would suggest that you might try something that would parse the output of show ip route, selecting routes associated with a particular interface, from that output eliminate any route that is connected, or is local, or is static. The result would be routes that were dynamically learned. What if an interface has zero dynamically learned routes? Is that a problem? If we assume that it is then we are setting ourselves up for false positives, because many routers have interfaces that have only user connections and so have zero dynamically learned routes.
So to resolve this potential problem your script would need to save its results for the router and compare the current results to the last n number of results. If an interface has zero dynamically learned routes and all of the last n results also had zero then this is normal. If an interface has zero dynamically learned routes and some of the last n results did have dynamically learned routes then you have identified a problem.
Yes this is complicated and possibly more effort than you want to expend. And yes this is harder than you originally thought.
HTH
Rick
11-30-2019 03:22 PM
I did some research and found a script using SNMP.
http://it-certification-network.blogspot.com/2008/12/generating-report-of-routing-table.html
That looks like a good base to start.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide