NetMRI API - Determine the default gateway for a subnet

[ Edited ]
Posts: 36
4770     0

I'm trying to find out the default gateway for a subnet. Is there any way to do this with the NetMRI API's?


What I'm actually trying is to mark all our gateway addresses in infoblox DDI with some extensible attribute so when selecting a new IP address in IPAM, we can also determine the default gateway for that subnet.

Re: NetMRI API - Determine the default gateway for a subnet

Posts: 353
4771     0

NetMRI doesn't really know what the default gateway is. But it can guess. We have this API call for devices:




However, it's not *really* what you want, because:


1) It returns a DeviceID not an IP. So you'd have to look for the IPs on that device in that subnet (you could use SubnetMember model for that). 

2) It is on a Device not a Subnet. That could be OK if you pick an end host in that subnet and call it on that. But if you pick a network device you won't get what you expect (because you'll get the upstream router from that or maybe the default route out the management interface!).

3) It's just a guess - it looks in the routing table for the default route (if it has one), if it can't find that it will look in the config file (if it has one, and I think that only does it for Cisco). Failing either of those, it falls back to convention - if I recall correctly, it first looks for an HSRP or VRRP VIP. If it finds that it will return the currently active router for the VIP (or for the lowest numbered VIP if there is more than one). Failing that it finally gives the lowest numbered router in the subnet.


So...I am not sure it will help you. I do think it makes sense to come up with a similar call for Subnet that returns an IP, though. That would seem to be useful.



Re: NetMRI API - Determine the default gateway for a subnet

Posts: 36
4771     0

I'll give it a try Smiley Happy We need it from an endhosts perspective so I should be able to find it somehow.


But anyway, the concept of "default gateway" is a bit lacking in DDI & NetMRI.


Imagine this scenario: a server admin requests an IP for his server (next available ip). The subnet it is in doesn't have DHCP active. When he wan't to configure the IP he got, he'll need a default gateway. But that's a peice of info he cannot get from DDI via that next available IP API.


We're going to try to solve this by adding a extensible attribute to the IP of the default gateway in that subnet and putting a wrapper around that DDI API that fetches bot next available IP and default gateway.


Right now, it's the initial import of all our default gateways into DDI that is the issue. We've got ~12000 subnets, so doing so manually is not an option.

Re: NetMRI API - Determine the default gateway for a subnet

Posts: 200
4771     0
Actually, in DDI that information is available as part of the subnet properties…if you set it. That’s the best place to extract the data from.

Whether you actually configure a DHCP range or not, there are still properties that are related to “auto assignment” (think API usage) that rely on the same data so you’d fill out what’s required in order to have that data served up to the request.
Showing results for 
Search instead for 
Did you mean: 

Recommended for You

Businesses are investing heavily into securing company resources from cyber-attacks form cybercrimin