VMware NSX is completely software based. This means it’s flexible as heck and you can have a lot of instances running concurrently. It also means you can go crazy with your network topology designs and amount of tinkering you can do with your virtual network. I am someone who loves to tinker. Sometimes a bit too much. A consequence of this, is that I sometimes break my virtual test lab and have to re-install it and return to the starting point. This has happened a few times.

I also like to use clean labs for customer demo purposes, just to make sure everything is clean and working for the demo. I have done the base install of NSX too many times and repetitive tasks need to be automated. 🙂 With these reasons combined, I created a solution to deploy and configure VMware NSX in 23 minutes.

By the way, if you’re curious about the 23 minutes in the title, check the timer in the usage paragraph below.

Enter PowerNSX

PowerNSX is a pretty complete PowerShell module for VMware NSX. The current development version includes a lot more functions than version 1, including a function to deploy the NSX Manager and register it to vCenter. This gave me an idea to create a script using PowerNSX to do the complete base install of NSX and save me a hour or two each time I need a clean environment. And in the words of a famous poet, ‘Well, that idea escalated quickly’.

configure VMware NSX

Current State

The script has evolved quite a bit and I’ve used it pretty often by now. It currently can do the following for you:

  • Deploy NSX Manager Appliance;
  • Do the registration to vCenter so the NSX plugin becomes available;
  • Deploy a dynamic amount of NSX Controllers;
  • Prepare ESXi hosts for NSX (install the VIBs);
  • Configure VXLAN on the ESXi hosts and do multicast & distributed switch configuration;
  • Add VMs to the Distributed Firewall exclusion list;
  • Create Logical Switches;
  • Create Edge Services Gateways;
  • Create Distributed Logical Routers.

All of this is packed in an Excel file for configuration, a slightly modified PowerNSX module and a script with which you can choose what you want to do. Want to only use it to create a bunch of Logical Switches? Or a quick base install? It can help you with that.

Usage

Using the installation script is pretty basic, just be sure the Excel file is filled out properly. The current state of the installation script is not forgiving when it comes to the information it needs. If something is missing out or incorrect, it’ll just fail halfway the task. Can’t say I didn’t warn you. 🙂

Once you’ve filled out the enter Excel file and downloaded the NSX Manager OVA, you can decide exactly what you want to do. Just a quick base install, or the whole shebang?

Usage: .\Install-NSX.ps1
   -SettingsExcel C:\install-nsx-info.xlsx                 - Mother of all information (required)
   -NSXManagerOVF C:\VMware-NSX-Manager-6.2.2-3604087.ova  - Location of the NSX Manager OVA (optional) (yes, you have to download this yourself)
   -DeployOVF             - Deploy the NSX Manager (optional)
   -RegistervCenter       - Register the NSX Manager to vCenter and SSO (optional)
   -DeployControllers     - Deploy the configured amount of NSX controllers (optional)
   -PrepareCluster        - Prepare the ESXi hosts in the vSphere cluster, configure VXLAN and add a Transport Zone (optional)
   -AddExclusions         - Add the VMs to the distributed firewall exclusion list (optional)
   -CreateLogicalSwitches - Create Logical Switches (optional)
   -CreateEdges           - Create Edge Services Gateways (optional)
   -CreateDLRs            - Create Distributed Logical Routers (optional)

Only the -SettingsExcel parameter is required and you can supply all other parameters as you see fit. To execute all tasks, supply all paramaters. To only create Logical Switches, only use the -SettingsExcel and -CreateLogicalSwitches parameters.

Here’s an example to deploy and configure the whole shebang:

PowerCLI D:\git\install-nsx> .\Install-NSX.ps1 -SettingsExcel D:\git\install-nsx-info.xlsx 
                                               -NSXManagerOVF D:\git\VMware-NSX-Manager-6.2.2-3604087.ova \
                                               -DeployOVF -RegistervCenter -DeployControllers \
                                               -PrepareCluster -AddExclusions -CreateLogicalSwitches \
                                               -CreateEdges -CreateDLRs

Starting NSX Manager deployment...
Deployed NSX Manager!
If you have other tasks for me, wait for the NSX Management Service to come onli
ne and press any key to continue...
Connecting to NSX Manager and registering it to vCenter...

WARNING: NSX Manager does not currently have a vCenter registration.  Use
Set-NsxManager to register a vCenter server.
Configured vCenter and SSO on NSX Manager!
Deploying NSX Controllers (1)...(this will take a while)
Deloying controller 1 ...
Controllers deployed!
Preparing vSphere cluster VSAN (installing VIBs)...
Configuring VXLAN on cluster VSAN
Adding a segment ID range..
Adding a multicast IP range..
Adding the VXLAN IP Pool..
Configuring VXLAN VTEPs on the cluster..
Adding transport zone..
Cluster prepared!
Adding VM exclusions from the distributed firewall..
Added 2 VMs to exclusion list!
Creating Logical Switches..
Added 3 Logical Switches!
Creating Edge Services Gateways..
Added 2 Edge Services Gateways!
Creating Distributed Logical Routers..
Added 1 Distributed Logical Routers!

00:23:07.7782050

Download

The installation script is available on GitHub. It’ll be improved as I use it more and need more functionality.

gitHub-download-button NSX

If you end up using it, let me know! Would love to know your use-cases.



Share the wealth!

Leave a Reply

Your email address will not be published. Required fields are marked *