API & Integration

Reply
Highlighted
Accepted Solution

Find 'parent' network or network_container object of a host address or network.

[ Edited ]
cmacnevin
Techie
Posts: 3
550     0

Hi, I'm hoping there's a way to walk 'up' the tree and get a network or network container object from
a host address.

 

Given a host address like 10.0.0.1, or a network object like 10.0.0.0/24, can it find that it is a member of a network object 10.0.0.0/23? Or the network_container 10.0.0.0/8? IP is naturally hierarchical, so I'm hoping there's an inherent relationship which can be exploited.

 
Note that this suggestion seems to be incorrect: https://community.infoblox.com/t5/API-Integration/Find-subnet-given-device-IP/m-p/8072/highlight/fal...

 

 

Re: Find 'parent' network or network_container object of a host address or network.

Adviser
Posts: 74
551     0

Just ask it for the desired attribute.  All the available attributes are documented in the REST API guide, which is available from the appliance.

 

Ask about the network that contains an IP address:

 

curl -k1 -u admin:infoblox -X GET 'https://192.168.1.2/wapi/v2.8/ipv4address' -d 'ip_address=10.9.11.34' -d '_return_fields=network'


returns:

[
    {
        "_ref": "ipv4address/Li5pcHY0X2FkZHJlc3MkMTAuOS4xNi4zNC8w:10.9.11.34",
        "network": "10.9.11.0/24"
    }
]

 

Ask about the network container that contains the network:

curl -k1 -u admin:infoblox -X GET 'https://192.168.1.2/wapi/v2.8/network' -d 'network=10.9.11.0/24' -d '_return_fields=network_container'


returns:

[
    {
        "_ref": "network/ZG5zLm5ldHdvcmskMTAuOS4xNi4wLzI0LzA:10.9.11.0/24/default",
        "network_container": "10.8.0.0/15"
    }
]

Re: Find 'parent' network or network_container object of a host address or network.

[ Edited ]
cmacnevin
Techie
Posts: 3
551     0

Thanks a lot for this.

I'm not familiar with that syntax. I'm using requests, and the following URL isn't working. Any idea?

URL: https://INFOBLOX_HOST/wapi/v2.9.1/member?ipv4_address=10.126.234.14&_return_fields=network&_return_as_object=1

#response from ip network lookup:

{'Error': "AdmConProtoError: Unknown argument/field: 'network'",

'code': 'Client.Ibap.Proto',

'text': "Unknown argument/field: 'network'"}

A quick search through the WAPI guide only lists '&_return_fields=network' in POST operations, incidentally. 

Re: Find 'parent' network or network_container object of a host address or network.

Adviser
Posts: 74
551     0

This will work:

 

https://INFOBLOX_HOST/wapi/v2.9.1/ipv4address?ip_address=10.126.234.14&_return_fields=network&_return_as_object=1

 

Your request is asking for a member object, which is an Infoblox appliance.  While there may be an appliance with that address, the member object does not have "network" as a field.

 

Instead you would have to ask for the network of the ipv4address object.

 

 

Showing results for 
Search instead for 
Do you mean 

Recommended for You

Infoblox ActiveTrust and a Deeper Dive Into your DNS Security