DNS DHCP IPAM

Reply
Highlighted
Accepted Solution

Export all IP addresses to a csv

SC_infoblox
Techie
Posts: 5
26439     0

Hi All,

 

I'm new to the forum here and I've been trying to look for solutions for my company for quite a while as we are impressed with the capabilities of what IPAM can help us in IP management. Thanks to the experts here that I think I found some lights in exporting a supernet range of IPs. I would like to seek any experts here or a script writer - Mr Don Smith as I read a post by him on his perl script - generic.pl_.txt. I have difficulties in linking all the functions mentioned in his script as I'm not a perl script expert. I hope I can get experts' help here in guiding me to understand and link up the functions to export a full list of supernet ip addresses with all the details attached to the IP. Example of having 10.0.0.0/16, I would like to list out all the IPs addresses in 1 shot, used or unused as shown in Infoblox IPAM, with the details in this supernet /16.

 

Hope to hear from you soon. Thanks in advance for the help given.

Re: Export all IP addresses to a csv

Adviser
Posts: 130
26440     0

Unfortunately I'm stuck in an all-day meeting and don't have time to provide a full answer. However it sounds as if what you want to do can be accomplished by searching for ipv4address objects (or ipv6address objects if you're doing IPv6 as well) that have a status value of 'USED'.

 

What I suggest trying as a first step is trying a WAPI query like the following; replace 'gm.example.com' with the name of your grid master, 'v2.2' with the WAPI version for your version of NIOS (you can find this in the beginning of the WAPI manual), and '192.168.0.0/24' with the CIDR value for one of your "leaf" networks (i.e., networks not contained in other networks):

 

https://gm.example.com/wapi/v2.2/ipv4address?network=192.168.0.0/24&status=USED&_return_type=xml-pretty

 

You could try just entering this URL into a browser like Internet Explorer, or use a curl command if you have that utility installed:

 

curl --tlsv1 --insecure --user 'admin' 'https://gm.example.com/wapi/v2.2/ipv4address?network=192.168.0.0/24&status=USED&_return_type=xml-pretty'

 

The output will give you a good idea of the sorts of fields that are returned by default for an ipv4address (or ipv6address) object. The WAPI manual contains additional fields that can be returned by specifying _return_fields or _return_fields+ in the query.

 

If you save the output from the browser query or the curl command you can try importing it into Excel as an XML file. That may also give you some idea of what gets returned.

 

There are two main issues with querying for ipv4address/ipv6address objects. First, a given object may contain multiple objects within it. For example, the ipv4address object returned for IP address 192.168.0.19 may have a DNS A record associated with it, a DNS PTR record, and a DHCP lease; the query will return objects for all three of these for a single address, and a script will typically need special code to split these out properly into a CSV file.

Second, searching for ipv4address/ipv6address objects with status = USED will return all addresses that are part of a DHCP range, even if no active lease exists for the address. Excluding addresses with no current lease would again require special code.

 

Can you provide more information on exactly what information you would like to be returned for each address, and how you'd like that information to be reflected in the CSV output? Then when I have more time I can try to put together a sample Python script using the WAPI. (Of course, others are welcome to try this as well.)

Re: Export all IP addresses to a csv

SC_infoblox
Techie
Posts: 5
26440     0

Hi Mr FHecker,

 

Thank you to reply to my help request.

 

I used the Curl command you proposed to me as follows:

 

curl --tlsv1 --insecure --user 'admin' ' https://ExportIPAM.com/wapi/v6.4/ipv4address?netw​ork=10.0.0.0/8&status=USED&_return_type=xml-pr​ett...

 

and I've got the following output and errors as follows:

 

curl: (6) Could not resolve host: '
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
</p>
</body></html>
'status' is not recognized as an internal or external command,
operable program or batch file.
'_return_type' is not recognized as an internal or external command,
operable program or batch file.

 

May I ask if you can guide me which portion of the command is wrong?

 

What I want to export is similar like the following for the supernet eg 10.0.0.0/8, used and unused in 1 csv file:

IP AddressNameMAC AddressStatusTypeUsageLease StateUser NameCommentLast DiscoveredOSNetBIOS NameSite
10.100.0.0 UsedIPv4 Network       
10.100.0.1Testing ip1ff:ff:ff:ff:ff:ffUsedIPv4 Fixed Address, IPv4 Reserved RangeDHCPFree test ipam    
10.100.0.2 UnusedIPv4 Reserved RangeFree      
10.100.0.3 UnusedIPv4 Reserved RangeFree      
10.100.0.4 UnusedIPv4 Reserved RangeFree      
10.100.0.5 UnusedIPv4 Reserved RangeFree      
10.100.0.6 UnusedIPv4 Reserved RangeFree      
10.100.0.7 UnusedIPv4 Reserved RangeFree      
10.100.0.8 Unused         
10.100.0.9 Unused         
10.100.0.10test 2ff:ff:ff:ff:ff:feUsedIPv4 Fixed AddressDHCP       
10.100.0.11 Unused         
10.100.0.12test 3ff:ff:ff:ff:ff:fdUsedIPv4 Fixed AddressDHCP  test 3 ipam   
10.100.0.13 Unused         
10.100.0.14 Unused         
10.100.0.15 Unused         
10.100.0.16 Unused         
10.100.0.17 Unused         
10.100.0.18 Unused         
10.100.0.19 Unused         

 

Hopefully I can also export all the attributes information we have in the infoblox too.

 

Waiting for your reply on my queries. Thank you in advance for the help.

Re: Export all IP addresses to a csv

Adviser
Posts: 130
26440     0

Are you using NIOS 6.4? (To check this, in the web interface go to the top-level "Grid" tab then to the "Upgrade" sub-tab, and look at the "Grid Version Information / Running" value.) I'm asking this because you included 'v6.4' in your curl command. For the Web API that value is not actually a NIOS version, it is the version of the Web API itself. So, for example, in my curl command I used the value 'v2.2'; that means version 2.2 of the WAPI, corresponding to version 7.2 of NIOS.

 

If your NIOS version really is 6.4 then you will not be able to use the Web API at all. The Web API was first introduced in NIOS 6.6 (which corresponds to WAPI version 1.0). In versions of NIOS prior to 6.4 the only API available is the Perl API (PAPI). I have not used the Perl API and am not very familiar with it, so I can't provide an example script for you. Let's first settle the question of which version of NIOS you have, and then we can see what the best next step is.

 

Re: Export all IP addresses to a csv

Adviser
Posts: 130
26440     0

FHecker wrote:

In versions of NIOS prior to 6.4 the only API available is the Perl API (PAPI).


My apologies. I meant to write "In versions of NIOS prior to 6.6 ...".

Re: Export all IP addresses to a csv

SC_infoblox
Techie
Posts: 5
26440     0

Hi Mr FHecker,

 

Thank you for your clarification. Our infoblox ver is 6.4. So meaning to say I won't be able to do WAPI and only on Perl script right? If yes, then is there any help probably you can provide for me to export used and unused IP addresses using Perl script, which previously written by Mr Don Smith? Thank you once again

Re: Export all IP addresses to a csv

Adviser
Posts: 130
26440     0

SC_infoblox wrote:

Our infoblox ver is 6.4. So meaning to say I won't be able to do WAPI and only on Perl script right?

 

That is correct. There is no support for the Web API (WAPI) in NIOS 6.4. The only supported API in NIOS 6.4 is the Perl API (PAPI).

 

I will look into how to use the Perl API for this problem if and when I have time, but I cannot promise a response in the short term -- I have not used Perl for a long time, and I am not familar with the Infoblox Perl API. I hope someone else on this forum will be able to help in the meantime.

 

Also, note that Infoblox support considers NIOS 6.4 to be in the category "End-of-life products with no active support". I strongly suggest that you consider upgrading to a more recent version of NIOS when you can. The most recent 6.x version is NIOS 6.12.12; this is also the only 6.x release that Infoblox support considers to be in the category "Active maintenance products with full engineering support for routine patches and bug fixes on all significant issues". (There are also three 7.x releases in this category.) Please contact your Infoblox account team for more information on upgrading NIOS, including supported hardware for NIOS 6.x and 7.x and options for professional services assistance with upgrades.

Re: Export all IP addresses to a csv

SC_infoblox
Techie
Posts: 5
26440     0
Thank you Mr FHecker for the updates. Need your advise on what is the stable NIOS version with no hiccups if I would like to try on the WAPI script you provided? I would then discuss with my boss for further action.

Re: Export all IP addresses to a csv

Adviser
Posts: 130
26440     0

SC_infoblox wrote:
Thank you Mr FHecker for the updates. Need your advise on what is the stable NIOS version with no hiccups if I would like to try on the WAPI script you provided?

I suggest that you talk with your Infoblox account team about this, because the answer will depend on what type of Infoblox hardware you are currently using and what newer Infoblox product features you would like to take advantage of. You have at least three choices:

 

  • Upgrade to an older NIOS 6.x release, for example NIOS 6.8 (of which the current patch release is 6.8.13). This would minimize changes from your current grid and provide at least support for security fixes. NIOS 6.8.13 supports WAPI version 1.2.1, which contains many useful enhancements over the original WAPI version in NIOS 6.6. One disadvantage of this release is that it considered to be "limited maintenance" at this time.
  • Upgrade to the most recent NIOS 6.x release, NIOS 6.12 (of which the current patch release is 6.12.13). NIOS 6.12 is considered an "active maintenance" release, meaning it has full Infoblox engineering support. NIOS 6.12 supports WAPI version 1.7.
  • Upgrade to a NIOS 7.x release. Currently 7.0, 7.1, and 7.2 are all considered "active maintenance" products. The 7.x releases support a number of new Infoblox products, some of which may be of interest to you; your account team can tell you more. Note that the 7.x releases will not run on the older "-A" appliances; however those appliances are going "end of life" at the end of 2015, and you will not be able to purchase Infoblox maintenance for them past that time.

 

Again, my best suggestion is to ask your Infoblox account team for advice. If you do not know who your account team is, please send me email at fhecker@infobloxfederal.com and I will find out for you.

 

Frank

 

 

 

Re: Export all IP addresses to a csv

SC_infoblox
Techie
Posts: 5
26440     0

Thank you Mr FHecker for the software upgrades information. We will request to upgrade the software to ver 6.12 first. Thereafter, I'll then be able to try out the WAPI command you shared with me. Will update here at a later time. Thank you so much.

Showing results for 
Search instead for 
Do you mean 

Recommended for You