Introduction
Proper network segmentation is essential for organizing workloads and securing traffic in Nutanix AHV. With acli and Bash, you can define and deploy VLAN-backed networks at scale, ensuring consistency across environments. This guide automates the creation of virtual networks using a repeatable, script-driven approach.
My Personal Repository on GitHub
Diagram: Network Provisioning Flow

Example YAML: networks.yaml
networks:
- name: VLAN10
vlan_id: 10
bridge: br0
- name: VLAN20
vlan_id: 20
bridge: br0
Bash Script: nutanix_network_create.sh
#!/usr/bin/env bash
set -euo pipefail
yq_bin="yq" # Ensure yq is installed
spec="networks.yaml"
log="/var/log/nutanix_networks_$(date +%F).log"
for i in $(yq e '.networks | keys | .[]' "$spec"); do
name=$(yq e ".networks[$i].name" "$spec")
vlan=$(yq e ".networks[$i].vlan_id" "$spec")
bridge=$(yq e ".networks[$i].bridge" "$spec")
echo "[$(date)] Creating network: $name VLAN:$vlan BRIDGE:$bridge" | tee -a "$log"
acli net.create "$name" vlan=$vlan vswitch_name=$bridge
done
Validation Script (Optional)
List all networks to verify:
acli net.list
Schedule via Cron (for dry-run testing)
0 6 * * 1 /usr/local/bin/nutanix_network_create.sh
Good for lab environments or bootstrapping new sites.
Best Practices
- Use unique names per VLAN ID
- Document which bridge (
br0,br1) maps to physical uplinks - Limit access to network creation to avoid misconfigurations
Summary
Using Bash and acli, you can standardize and automate the creation of virtual networks on Nutanix AHV. This reduces manual errors, speeds up provisioning, and integrates well with infrastructure-as-code pipelines.
External Documentation:
Introduction Snapshots are a key feature in any backup or testing workflow. Managing them at scale, however, requires automation. With Bash and...