Category: VCNS

March 5th, 2017 by axel

vShield is a very nice soft but one can admit that sometimes, it can be really paintfull to modify some item configuration.
In this post, we will see how to modify the MTU of a dvSwitch that is being used in a Network prepared cluster.

The procedure consists of three steps :

Installing Firefox
Retrieving dvSwitch configuration
Updating dvSwitch configuration

 

Installing Firefox Rest Client

Several tools exist for this but when I first worked on this topic, I used the Firefox Rest client. You can find it here.

Once downloaded, we have to deploy it.
More than easy :

  • Just open your Firefox browser > Tools Menu > “Install Add-on from file…”

  • Select your XPI file.
  • “Install Now”.
  • Restart the browser as in required. That’s all.

The plugin is now available :

If you get the message below after selecting the XPI file :

– Edit Mozilla configuration file and replace the line « lockPref(“xpinstall.enabled” ,false) » by « lockPref(“xpinstall.enabled” ,true) ».
Save the file.
– Replay the Add-on installation step.

 

Get vDSwitch information

Load your RestClient
You should get this page :

Now, configure the header of your requests by setting an authentication profile :

  • Select menu “Authentication” > “Basic Authentication”

  • Provide an administrator account and its password.

In my case, I choose vShield local admin account
You can now see the authentication information in the header panel

Once done, you can run GET requests.
Let’s retrieve the ID of the dvSwitch we want to reconfigure.

  • In the REQUEST panel, make sure the GET method is selected
  • Type the URL « https://vcns_fqdn/api/2.0/vdn/switches »
  • Click on “SEND” button to execute the query.
  • The result should be displayed, to make it readable, go to tab “Response Body (Preview)”.
  • You can now get the ID of the dvSwitch you are instered in.

As we will need right after to send a XML request, I higly suggest to copy the content of the vdsContext tag.
Doing so, you should get :
<vdsContext>
<switch>
<objectId>dvs-26</objectId>
<type>
<typeName>VmwareDistributedVirtualSwitch</typeName>
</type>
<name>DSwitchProd</name>
<revision>44</revision>
<objectTypeName>VmwareDistributedVirtualSwitch</objectTypeName>
<scope>
<id>datacenter-21</id>
<objectTypeName>Datacenter</objectTypeName>
<name>Datacenter1</name>
</scope>
<extendedAttributes/>
</switch>
<mtu>1600</mtu>
<teaming>FAILOVER_ORDER</teaming>
<uplinkPortName>Uplink 2</uplinkPortName>
<uplinkPortName>Uplink 1</uplinkPortName>
<promiscuousMode>false</promiscuousMode>
</vdsContext>

 

Modify vDSwitch configuration

To reconfigure a setting we have to use another REST method, PUT*.
To do so, we first have to add another information in the request header, the format we’ll use to send the data.

* In REST language, several methods are supported depending on the URi you are  working with. The main four are : GET, PUT, POST, DELETE
GET helps in getting information
PUT, in modifying an existing entry
POST, in adding a new entry
DELETE, in deleting an existing entry.

 

  • Still from the page of the REST Client, go to menu “Headers” > “Custom Header”.
  • In Name field, type “Content-type” and in Value field, “application/xml” and validate.

Headers must have changed 

The header is now ready, let’s prepare the update request.

In the REQUEST panel :

  • Change to method and set it to “PUT”.
  • Enter the URL « https://vcns_fqdn/api/2.0/vdn/switches/dvSwitch_id ». dvSwitch_id value has been retrieved earlier thanks to the GET request.
  • In the BODY panel, paste the content of the XML returned previously (GET method)
  • Modify the MTU according to the one we have to apply.
Your XML should look like this :

<vdsContext>
<switch>
<objectId>dvs-26</objectId>
<type>
<typeName>VmwareDistributedVirtualSwitch</typeName>
</type>
<name>DSwitchProd</name>
<revision>44</revision>
<objectTypeName>VmwareDistributedVirtualSwitch</objectTypeName>
<scope>
<id>datacenter-21</id>
<objectTypeName>Datacenter</objectTypeName>
<name>Datacenter1</name>
</scope>
<extendedAttributes/>
</switch>
<mtu>9000</mtu>
<teaming>FAILOVER_ORDER</teaming>
<uplinkPortName>Uplink 2</uplinkPortName>
<uplinkPortName>Uplink 1</uplinkPortName>
<promiscuousMode>false</promiscuousMode></vdsContext>

 

Press “SEND” to execute the query and verify the status code in the tab “Response Headers”, it must be “200 OK”.

  • Go to your vCNS administration console and navigate to “Datacenter” > “Datacenter xx” > tab “Network Virtualization” > “Preparation”
  • Check the MTU of your dvSwitch (look at the cluster attached to your dvSwitch)

Another way to check the new MTU :
Via CLI command, on each ESX attached to the dvSwitch : esxcli network nic list
Check the MTU for the NIC attached to the dvUplink participating to VXLAN.

 

If you are wondering if the procedure described is reusable with NSX, the answer is NO.
The PUT request does not work, actually it is even not supported.
BUT, you can easily change the MTU thanks to your vSphere Web Client.
From the Network view, just edit the settings of your dvSwitch and change your MTU.

Posted in VCNS, Virtualization Tagged with: , ,