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:
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!
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:
- 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).
- Create second port-group and add "Second" as a name for it and add 11 as VLAN ID.
- Add two network adapter to the VM.
- Choose "First" as network label for the first NIC.
- 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.
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!
Sorry, I mean, you have to add your VLAN ID instead of the mentioned VLAN IDs.
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 ?
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.
My switch do not have options for setting VLAN. So in that case i can not create a VPS with 2 or more IPs ?