Infoblox DDI Commands
Overview
The netapi infoblox command group provides CLI access to Infoblox NIOS via the Web API (WAPI) for managing IP Address Management (IPAM), DNS records, and DHCP operations.
Prerequisites
Load secrets before using Infoblox commands:
dsource d000 dev/network
Required environment variables:
| Variable | Description |
|---|---|
|
Grid Master IP or hostname |
|
API username |
|
API password |
| The WAPI user must have appropriate permissions for the operations you need. Configure in Infoblox: Administration > Administrators > Add User. |
Commands Reference
| Command | Description |
|---|---|
IPAM |
|
|
List networks in IPAM |
|
Get next available IP(s) in a network |
|
Search for an IP across all object types |
DNS |
|
|
List host records |
|
List A records |
|
Create a host record |
|
Create an A record |
DHCP |
|
|
List DHCP leases |
|
List DHCP reservations (fixed addresses) |
|
Create a DHCP reservation |
|
List DHCP ranges |
IPAM Commands
get-networks
List networks in IPAM:
netapi infoblox get-networks
Networks (5) ┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓ ┃ Network ┃ Netmask ┃ View ┃ Comment ┃ ┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩ │ 10.50.0.0/16 │ 255.255.0.0 │ default │ Data Center │ │ 10.60.0.0/16 │ 255.255.0.0 │ default │ Campus │ │ 192.168.1.0/24 │ 255.255.255.0 │ default │ Guest WiFi │ │ 172.16.0.0/12 │ 255.240.0.0 │ default │ VPN Pool │ │ 10.100.0.0/24 │ 255.255.255.0 │ default │ DMZ │ └────────────────┴─────────────────┴───────────┴──────────────────┘
Filter by pattern:
# Networks starting with 10.50
netapi infoblox get-networks --pattern "10.50.*"
# JSON output for scripting
netapi infoblox get-networks --format json
DNS Commands
get-host-records
List DNS host records:
netapi infoblox get-host-records
Host Records (8) ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━┓ ┃ Name ┃ IP Address(es) ┃ View ┃ Comment ┃ ┡━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━┩ │ dc-01.example.com │ 10.50.1.50 │ default │ DC Primary │ │ dc-02.example.com │ 10.50.1.51 │ default │ DC Secondary│ │ ise-01.example.com │ 10.50.1.20 │ default │ ISE PAN │ │ web-01.example.com │ 10.50.1.100 │ default │ Web Server │ └───────────────────────────┴─────────────────┴───────────┴─────────────┘
Filter by name pattern:
# Records containing "dc"
netapi infoblox get-host-records --pattern "dc*"
# JSON output
netapi infoblox get-host-records --format json
get-a-records
List DNS A records:
netapi infoblox get-a-records
A Records (12) ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━┓ ┃ Name ┃ IP Address ┃ View ┃ Comment ┃ ┡━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━┩ │ www.example.com │ 10.50.1.100 │ default │ Web VIP │ │ api.example.com │ 10.50.1.101 │ default │ API VIP │ │ mail.example.com │ 10.50.1.25 │ default │ Mail server │ └───────────────────────────┴─────────────────┴───────────┴─────────────┘
create-host
Create a DNS host record:
netapi infoblox create-host "server-01.example.com" "10.50.1.150"
Created: server-01.example.com -> 10.50.1.150 Ref: record:host/ZG5zLmhvc3QkLl9kZWZhdWx0LmNvb...
Options:
| Option | Default | Description |
|---|---|---|
|
default |
DNS view |
|
Record comment |
netapi infoblox create-host "db-01.example.com" "10.50.2.50" \
--view "internal" \
--comment "Production database server"
DHCP Commands
get-leases
List DHCP leases:
netapi infoblox get-leases
DHCP Leases (25) ┏━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━┓ ┃ IP Address ┃ MAC ┃ Hostname ┃ State ┃ Expires ┃ ┡━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━┩ │ 10.50.10.101 │ 00:0c:29:ab:cd:01 │ laptop-01 │ active │ 2026-02-22T10:30:00│ │ 10.50.10.102 │ 00:0c:29:ab:cd:02 │ phone-01 │ active │ 2026-02-22T11:15:00│ │ 10.50.10.103 │ 00:0c:29:ab:cd:03 │ printer-01 │ active │ 2026-02-22T09:45:00│ └─────────────────┴───────────────────┴───────────────┴─────────┴────────────────────┘
Filter by MAC:
netapi infoblox get-leases --mac "00:0c:29:ab:cd:01"
get-reservations
List DHCP reservations (fixed addresses):
netapi infoblox get-reservations
DHCP Reservations (15) ┏━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┓ ┃ IP Address ┃ MAC ┃ Name ┃ Network ┃ Comment ┃ ┡━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━┩ │ 10.50.1.100 │ 00:50:56:ab:cd:ef │ web-01 │ 10.50.1.0/24 │ Web server │ │ 10.50.1.101 │ 00:50:56:ab:cd:f0 │ app-01 │ 10.50.1.0/24 │ App server │ │ 10.50.2.10 │ 14:f6:d8:7b:31:80 │ workstation │ 10.50.2.0/24 │ Admin WS │ └─────────────────┴───────────────────┴───────────────┴────────────────┴─────────────┘
create-reservation
Create a DHCP reservation:
netapi infoblox create-reservation "10.50.1.150" "00:50:56:ab:cd:01"
Created: 10.50.1.150 -> 00:50:56:ab:cd:01 Ref: fixedaddress/ZG5zLmZpeGVkX2FkZHJlc3MkLjEwLjUw...
Options:
| Option | Default | Description |
|---|---|---|
|
Hostname for the reservation |
|
|
Comment |
netapi infoblox create-reservation "10.50.1.150" "00:50:56:ab:cd:01" \
--name "new-server" \
--comment "New application server"
get-ranges
List DHCP ranges:
netapi infoblox get-ranges
DHCP Ranges (4) ┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ Network ┃ Start ┃ End ┃ Comment ┃ ┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━┩ │ 10.50.10.0/24 │ 10.50.10.100 │ 10.50.10.200 │ Workstation pool │ │ 10.50.20.0/24 │ 10.50.20.50 │ 10.50.20.150 │ VoIP phones │ │ 192.168.1.0/24 │ 192.168.1.100 │ 192.168.1.200 │ Guest WiFi │ │ 10.60.0.0/24 │ 10.60.0.10 │ 10.60.0.250 │ Campus DHCP │ └────────────────┴───────────────┴───────────────┴───────────────────────┘
Filter by network:
netapi infoblox get-ranges --network "10.50.10.0/24"
Workflows
Provision New Server
#!/bin/bash
# Workflow: Provision IP and DNS for new server
dsource d000 dev/network
NETWORK="10.50.1.0/24"
HOSTNAME="new-server.example.com"
# 1. Get next available IP
IP=$(netapi infoblox get-next-ip "$NETWORK" | head -1)
echo "Allocated IP: $IP"
# 2. Create host record (DNS + IP association)
netapi infoblox create-host "$HOSTNAME" "$IP" --comment "Provisioned $(date +%Y-%m-%d)"
# 3. Create DHCP reservation if server uses DHCP
# MAC="00:50:56:xx:xx:xx"
# netapi infoblox create-reservation "$IP" "$MAC" --name "new-server"
echo "Server provisioned: $HOSTNAME -> $IP"
Bulk DNS Import
#!/bin/bash
# Import hosts from CSV
# Format: fqdn,ip,comment
dsource d000 dev/network
while IFS=, read -r fqdn ip comment; do
netapi infoblox create-host "$fqdn" "$ip" --comment "$comment"
sleep 0.5 # Rate limit
done < hosts.csv
Export for Documentation
#!/bin/bash
# Export all IPAM data for documentation
DATE=$(date +%Y%m%d)
mkdir -p /backup/infoblox/$DATE
netapi infoblox get-networks --format json > /backup/infoblox/$DATE/networks.json
netapi infoblox get-host-records --format json > /backup/infoblox/$DATE/hosts.json
netapi infoblox get-a-records --format json > /backup/infoblox/$DATE/a-records.json
netapi infoblox get-reservations --format json > /backup/infoblox/$DATE/reservations.json
netapi infoblox get-ranges --format json > /backup/infoblox/$DATE/ranges.json
echo "Exported to /backup/infoblox/$DATE"
Troubleshooting
Authentication Failed
# Verify environment variables
echo "Host: $INFOBLOX_HOST"
echo "User: $INFOBLOX_USER"
# Test API connectivity
curl -k -u "$INFOBLOX_USER:$INFOBLOX_PASS" \
"https://$INFOBLOX_HOST/wapi/v2.12/network?_return_fields=network"
Check Infoblox user permissions: 1. Administration > Administrators 2. Edit user 3. Verify API access role (e.g., "Read-Only API User" or "IPAM Admin")
Network Not Found
The get-next-ip command requires an exact CIDR match:
# WRONG - partial match
netapi infoblox get-next-ip 10.50.0.0/16
# CORRECT - exact network CIDR as defined in Infoblox
netapi infoblox get-next-ip 10.50.1.0/24
List networks to find exact CIDR:
netapi infoblox get-networks --pattern "10.50*"
Record Already Exists
Infoblox returns an error if you try to create a duplicate record:
# Search first
netapi infoblox get-host-records --pattern "server*" --format json | \
jq '.[] | select(.name | contains("server-01"))'
SSL Certificate Errors
The client disables SSL verification by default (for self-signed certs). If you need to enable it:
from netapi.vendors.infoblox import InfobloxClient
client = InfobloxClient(
host="infoblox.example.com",
username="admin",
password="secret",
verify_ssl=True # Enable certificate verification
)