(Moving this from SuperUser, I realized it's more appropriate here)
Hey all, I need to figure out how to reliably get various pieces of information for network interfaces via SNMP, such as the network card's IP address, Gateway, DNS Search Server list, and if DHCP is enabled on the interface.
Unfortunately I am finding that this information is scattered to the four corners of the (SNMP) globe, and I'm having a heck of a time tracking all of it down. So far I have the IP address, and I think I have figured out how to glean the gateway, though I'd appreciate if someone could proof my "algorithm" for doing so as I am also uncertain about how to do it for IPv6.
I cannot locate:
- DNS servers search list, per network interface card
- DHCP Enabled/Disabled (i.e., fixed or variable IP Address), per network interface card
This is the "algorithm" I have come up with to obtain a gateway:
- For every entry in the IF MIB ifTable where ifType = Ethernet, get the ifIndex
- If the ifIndex can be found in the IP Forward MIB inetCidrRouteTable:
- For IPv4 addresses, if inetCidrRouteDest = 0.0.0.0, the gateway is inetCidrRouteNextHop
- I do not know what to do for IPv6 addresses???
- Otherwise, if the ifIndex can be found in the IP Forward MIB ipCidrRouteTable
- if ipCidrRouteDest = 0.0.0.0, the gateway is ipCidrRouteNextHop
- Otherwise, if the ifIndex can be found in the IP Forward MIB ipForwardTable
- if ipForwardDest = 0.0.0.0, the gateway is ipForwardNextHop
- Otherwise, if the ifIndex can be found in the RFC 1213 MIB ipRouteTable
- if ipRouteDest = 0.0.0.0, the gateway is ipRouteNextHop
Phew! As you can see, a nasty nightmare. So can anyone proof/complete my gateway algo above, or tell me about DNS/DHCP?
Also just FYI, Unix/Linux shell script alternatives won't cut it -- for one I know how to do it that way already, and also I need to interrogate non-*nix devices like Cisco switches & routers, and network printers.
Thanks!