For study purposes (VCAP-NV) i was trying to set-up an L2 VPN connection between an ESG in my home lab and a ESG that was running on a dedicated ESXi host in a datacenter.
When i tried to configure the sub interface of the ESG (which you need to do on both sides) i was getting an unfortunate GUI error. Adding the interface itself with a name, tunnelID and Connected to network was not a problem. But when i tried to setup the primary ip address i was getting this weird error:
Tried all kind of settings, but didn’t get it working in the GUI when i selected the type of interface as trunk.
Two solutions; API or PowerNSX. Since PowerNSX is really cool stuff, and i’ve not done a lot with it until now i chose to try it with PowerNSX.
The first thing what i had to do was install the PowerNSX module via Powershell Gallery.
> Find-Module PowerNSX | Install-Module -scope CurrentUser
Then i needed to connect to my vCenter server and my NSX Manager.
> Connect-NsxServer -vCenterServer vcsa01.wesleygeelhoed.local
> Connect-ViServer vcsa01.wesleygeelhoed.local
Determine which ESG i needed to configure (edge-id), and create a new subinterface on it.
> Get-NSXEdge -Name ESG-02
> Get-NsxEdge -objectId edge-3 | Get-NsxEdgeInterface -Index 3 | New-NsxEdgeSubInterface -Name Tunnelid1_L2VPN -TunnelId 1 -PrimaryAddress 192.168.33.254 -SubnetPrefixLength 24
As you can see in my screenshot below, the subinterface is now successfully created with type ‘trunk’ and with a configured primary IP address.