Adding a second Network Adapter and setting vlan

How to add a second Network Adapter and set vlan? I am using the next code lines for adding a NIC and setting VLAN on vmware, but is not working.
idx = 1
:network => ‘dvs_VLANX’,
:devicetype => ‘VirtualE1000’,
:is_dvs => false
:ip_addr => ‘’,
:subnet_mask => ‘’,
:addr_mode => [‘static’, ‘Static’]

@pemcg Can you help me?


We use the following instead of set_network_adapter to set vlan name:

networks = [{:network=>"vlan1", :mac_address=>nil},
            {:network=>"vlan2", :mac_address=>nil}]
prov.set_option(:networks, networks)

And we use the following before the set_nic_settings method:

prov.set_option(:requested_network_adapter_count, 2)


1 Like

You gave me a clue. I changed my previous code for this and works.

prov.set_network_adapter(0, {:network=>"VLANX", :is_dvs=>true})
prov.set_network_adapter(1, {:network=>"VLANY", :is_dvs=>true})

Hi I am trying to add an additional NIC to VM after provisioning is completed (already deployed VM) running on VMware 6.5. Using a service catalog or button to add NIC. Do you have any suggestion on how I could do that? I do not want to tweak customization spec as majority of my VM would not have more than one NIC.