Maxi Best Of Nutanix CLI : Subnets Management

In the previous blog post on the Maxi Best Of Nutanix CLI menu, I presented you with the best commands for checking the entire network configuration of your Nutanix cluster.
In this new article, we’ll now see how CLI commands can help us create or modify networks in our Nutanix cluster…
All the commands in this article must be executed at one of the CVMs in the cluster.
Creating an Unmanaged Subnet on Nutanix AHV
To create a new unmanaged subnet (without IPAM) across the AHV cluster, the command is very simple:
acli net.create NAME vlan=VLAN_ID
Replace:
- NAME with the name you want to assign to your subnet
- VLAN_ID with the VLAN ID
Here’s an example command that creates the VLAN “NUTANIX” with the VLAN vlan id “84” :
acli net.create NUTANIX vlan=84
By default, the vlan will be created on the vswitch “vs0” but if you want to create it on another virtual switch, you can specify it as a parameter:
acli net.create NAME vlan=VLAN_ID virtual_switch=VSWITCH
In this case, replace:
- NAME with the name you want to assign to your subnet
- VLAN_ID with the VLAN ID
- VSWITCH with the name of the bridge on which you want to create the subnet
Here is an example of a command that allows you to create the “NUTANIX” VLAN with comme vlan id “84 sur le vswitch “vs0” :
acli net.create NUTANIX vlan=84 virtual_switch=vs0
You can then run the “acli net.list” command and check that your new subnet appears in the list.
Creating a Managed Subnet on Nutanix AHV
This command creates a new managed subnet (using IPAM) across the AHV cluster with basic gateway and subnet mask options.
acli net.create NAME vlan=VLAN_ID virtual_switch=vs0 ip_config=GATEWAY/MASK
Replace:
- NAME with the name you want to assign to your subnet
- VLAN_ID with the VLAN ID
- vs0 with the name of the bridge on which you want to create the subnet
- GATEWAY with the IP address of the subnet’s gateway
- MASK with the subnet mask
Here is an example of a command that creates the VLAN “NUTANIX” with a vlan id “84” on the vswitch “vs0”, with a gateway address “10.0.84.254” on the network “10.0.84.0/24”:
acli net.create NUTANIX vlan=84 virtual_switch=vs0 ip_config=10.0.84.254/24
Deleting an Existing Subnet
Deleting an existing subnet on a Nutanix AHV cluster is easy! Simply run the following command:
acli net.delete NAME
You must replace NAME with the name of the subnet you wish to delete, which would give, for example, for the previously created subnet:
acli net.delete NUTANIX
Nothing could be simpler!
Bulk Subnet Creation/Deletion
To make it easier to import large quantities of subnets, I created several CSV files that I can then convert into a list of commands to create multiple subnets in batches.
Everything is on my Github: https://github.com/Exe64/NUTANIX
For unmanaged subnets: https://github.com/Exe64/NUTANIX/blob/main/nutanix-unmanaged-subnets.csv
For managed subnets: https://github.com/Exe64/NUTANIX/blob/main/nutanix-managed-subnets.csv
For deleting subnets: https://github.com/Exe64/NUTANIX/blob/main/nutanix-subnets-delete.csv
To learn more about using these files, I invite you to consult my dedicated article:
Official Documentation
Complete command documentation is available on the publisher’s official website: https://portal.nutanix.com/page/documents/details?targetId=Command-Ref-AOS-v6_10:man-acli-c.html
0 comments