VMware Cloud Community
scotty_p
Enthusiast
Enthusiast
Jump to solution

Connecting VMs to multiple VLANs

I've got 2 NIC's coming out of my ESX server. 1 for the service console and 1 for VMs.

I've got 4 vm's and I need each of them to be on a different vlan in our network. The physical switch I'm connecting to can access all of the VLANs.

What would be the best/easiest way to accomplish this.

Thanks for any help.

Reply
0 Kudos
1 Solution

Accepted Solutions
Dave_Mishchenko
Immortal
Immortal
Jump to solution

You'll need to configure the physical port on your switch to which the VM nic is connected to as a trunk port. Then in the vSwitch for you VMs, you'll need to create 4 virtual machine port groups. You'll then set the appropriate VLAN ID for each VM port group and then connect the virtual NICs to the correct VM port group.

http://www.vmware.com/pdf/esx3_vlan_wp.pdf

View solution in original post

Reply
0 Kudos
3 Replies
Dave_Mishchenko
Immortal
Immortal
Jump to solution

You'll need to configure the physical port on your switch to which the VM nic is connected to as a trunk port. Then in the vSwitch for you VMs, you'll need to create 4 virtual machine port groups. You'll then set the appropriate VLAN ID for each VM port group and then connect the virtual NICs to the correct VM port group.

http://www.vmware.com/pdf/esx3_vlan_wp.pdf

Reply
0 Kudos
EGRAdmin
Enthusiast
Enthusiast
Jump to solution

So you have 4 VM's and each one needs to be on it's own VLAN?

I would think the easiest way would be to add 4 seperate port groups on the second NIC.

One for each VLAN/server (VM).

You can do this from the SC with your own modifications of the below commands;

Create your swtich and link your vmnic then add your port group to your vswitch and assign the port group to it's specific vlan on the specific switch.

esxcfg-vswitch --add-pg=your-server-group Your-vswitch

esxcfg-vswitch --pg=port-group-name --vlan=vlan-# your-vsiwtch

service network restart

Example;

esxcfg-vswitch --add-pg=Prod-VLAN-1 vSwitch1

esxcfg-vswitch --pg=Prod-VLAN-1 --vlan=5 vSwitch1

service network restart

Or through the VI client by going to the properties on your network and adding the appropriate networking fields.

(Add / connection type/virtual machine)

scotty_p
Enthusiast
Enthusiast
Jump to solution

Thank you both. This worked perfectly.

Reply
0 Kudos