VMware Cloud Community
vivasindustries
Contributor
Contributor

Trouble when attaching new vSwtich and assigning VLAN to it.

I am using ESXI 6.0.

I have two physical NICs to my dedicated server.
So in this case i have two vSwitches.

As a default management switch i user vSwtich0 and this switch seems to have no VLAN assigned.

Then i login in my vSphere client and when i click on  "Add Networking.." and i choose "Virtual Machine" after that i choose 'vSwitch1" and on the next page where i am asked to assign VLAN ID i assign 1.
Note that on vSwitch0 I do not have any VLAN ID assigned.

There comes the trouble. When i set on the Virtual NIC of  Virtual Machine there is no internet connection. But if i remove vSwitch1 and reattach it again but this time with no VLAN ID assignment there is no problems. I can connect to the Internet without problems.

After all i am trying to create one Virtual Machine with two Vitrual NICs connected to it and make that Virtual Machine accessible from two different IP addresses. One IP from vSwitch0 and one IP vSwtich1. Is it possible? Can i do that?

I was reading that in order to do that i must have VLAN IDs in place, but i am not sure if it is correct in order to achieve that.

I found this guide of how can i add additional IP to Virtual Machine How to: Configure Additional IP Addresses on Hypervisors - Ubiquity Hosting Blog but it seems pretty hard to me. Is there any easier way?
I don't know if it is important but my server is connecting to the Internet via DHCP.

I hope you can help me.

Thanks in advance!

Reply
0 Kudos
8 Replies
DavoudTeimouri
Virtuoso
Virtuoso

First, as you know, you can't assign VLAN ID to virtual switch and VLAN ID should be assigned to port group.

If port group has VLAN ID then VLAN tag will be assigned to each packet and ESXi does tagging and if you configure your VM NIC to tagging traffic, the traffic will be dropped.

You can assign more than one NIC to your VM and so you can have more than one VLAN on your VM and send your traffic to different subnets but it needs to configuration on your VM and it's depended to your VM OS.

Please read the below blogs and KBs for more information:

http://rickardnobel.se/vswitch-and-vlan-tagging-part-1/

VMware KB: Sample configuration of virtual switch VLAN tagging (VST Mode)

-------------------------------------------------------------------------------------
Davoud Teimouri - https://www.teimouri.net - Twitter: @davoud_teimouri Facebook: https://www.facebook.com/teimouri.net/
Reply
0 Kudos
vivasindustries
Contributor
Contributor

DavoudTeimouri‌ thanks for the help!

After all my final goal is to achieve one VM with two or more IPs from one vSwitch.
I know how i can set up the OS of the VM itself but i am not sure how i must setup the VM at the vSphere client.

Can you please just give me guidance of how can i create one VM with two or more IPs assigned to it from one vSwitch ?
What is important and for what i must look for in order to achieve that goal?

Thanks in advance!

Reply
0 Kudos
DavoudTeimouri
Virtuoso
Virtuoso

Hi,

It's too simple. You must create two or more "Port-Group" on the vSwitch then add two or more "Network Adapter" to your VMs (Please note that number of network adapter is limited and you can add 10 network adapter to a VM with hardware version 10).

Here is an example:

  1. Create first port-group and add "First" as a name for it and add 10 as VLAN ID. (You need to have change VLAN ID with your VLAN ID that it's configured on your physical switches).
  2. Create second port-group and add "Second" as a name for it and add 11 as VLAN ID.
  3. Add two network adapter to the VM.
  4. Choose "First" as network label for the first NIC.
  5. Choose "Second" as network label for the second NIC.

Then you can configure two different IP addresses on the two NICs in the guest OS.

-------------------------------------------------------------------------------------
Davoud Teimouri - https://www.teimouri.net - Twitter: @davoud_teimouri Facebook: https://www.facebook.com/teimouri.net/
Reply
0 Kudos
vivasindustries
Contributor
Contributor

Hello DavoudTeimouri‌ and thank you for helping me!

I was working under this for days and I hope i'll be able to achieve it at the end.


Your guide is great, but i am not sure what does this means: (You need to have change VLAN ID with your VLAN ID that it's configured on your physical switches)

What do you mean with that, i am not sure I understand it.

Thanks in advance!

Reply
0 Kudos
DavoudTeimouri
Virtuoso
Virtuoso

Sorry, I mean, you have to add your VLAN ID instead of the mentioned VLAN IDs.

-------------------------------------------------------------------------------------
Davoud Teimouri - https://www.teimouri.net - Twitter: @davoud_teimouri Facebook: https://www.facebook.com/teimouri.net/
Reply
0 Kudos
vivasindustries
Contributor
Contributor

I do not think i have VLAN id configured on my physical switches.
How can i check that and set them up if they are not configured ?

Reply
0 Kudos
DavoudTeimouri
Virtuoso
Virtuoso

Hi,

So this is your problem.

If you need to configure VLAN, you should logon to your switch and configure VLANs and native VLAN on the switch.

Create VLAN needs to some knowledge about your switch embedded OS.

Read your switch help or manual on this regard.

-------------------------------------------------------------------------------------
Davoud Teimouri - https://www.teimouri.net - Twitter: @davoud_teimouri Facebook: https://www.facebook.com/teimouri.net/
Reply
0 Kudos
vivasindustries
Contributor
Contributor

My switch do not have options for setting VLAN. So in that case i can not create a VPS with 2 or more IPs ?

Reply
0 Kudos