natiya2
Contributor
Contributor

How to connect a virtual machine to two different external networks

I have a server with vSphere installed. The server has 2 physical ethernet ports: one it's empty and the other one it's connected to the management network.

There is one vSwitch connected to this ethernet port and to my virtual machine, so I can access this virtual machine through the management network.

Now, I need to connect this virtual machine to a different external network too.

I was wondering how to configure the other physical ethernet port of the server in vSphere and the virtual machine, if I need to create another vSwitch, etc

Thank you!

8 Replies

The best way (and recomended) is to use have both pNICs connected to your switch in Trunk Mode allowing all the VLANs that you need to use in the virtual platform.

Then, you´ll have one vSwitch, with different Port Groups for VLANs.

If in your platform, those are different physical switches for example, you can achieve that connecting the secon pNIC to that switch, create a new vSwitch and then a portgroup. Add a new vNIC to the VM and connect to that one.

(but strongly recommend you working with trunk and consolidatin in ToR switches for example, and propagatin VLANs to enable your ESXi to reach both vlans using trunk with both pNICs.

If neither both scenarios are right, please provide a simple (mspaint) diagram :smileysilly:

-------------------------------------------------------------------
Triple VCIX (CMA-NV-DCV) | vExpert | MCSE | CCNA
0 Kudos
NathanosBlightc
Commander
Commander

Hello and welcome to the community

Remember some point of vSphere networking design, especially standard vSwitch:

1. Each of physical adapters (uplink or vmnic) only belongs to a single vSwitch and you cannot share it, so when you decide to separate virtual machines networking to the different physical networks, you should create two separate vSwitch and each of existing physical NICs must belongs to only one of them. You can migrate uplinks and move them between vSwitches, but in a current state, they are part of a single vSwitch.

2. For VM connectivity you should create virtual machine PortGroups and connect their virtual NICs to them. Each port group can be part of a single standard vSwitch. So you should create two separate port groups in each of those mentioned vSwitches. So the connected uplinks to the vSwitch, can handle traffic of VMs from their associated portgroup in vSwitch.

They are all basic rules of vSphere networking, you can design and implement many structure by using the vSwitch/portgroup failover order, setup VLAN ID and so on based on your requirements.

Please mark my comment as the Correct Answer if this solution resolved your problem
natiya2
Contributor
Contributor

it's one VM connected to two external networks, accessible through two physical Ethernet port. At the moment, the VM is connected to one of this network through a vSwitch connected to one of the physical NICs. This is the situation:

vsphere.png

So I want to connect "VM" with "External network 2". Therefore, I guess I need:

- another vNIC

- another vSwitch?

Thanks!Smiley Happy

0 Kudos
NathanosBlightc
Commander
Commander

Yes of course but more precisely:

Another vNIC

Another vSwitch that 2nd pNIC is connected to it

Another virtual machine port group in the new vSwitch to handle your VM traffic

Please mark my comment as the Correct Answer if this solution resolved your problem

Yes! you need to:

1- Create new vSwith with pNIC2 as uplink

2- Create new PortGroup

3- Connect VM to that portgroup.

Natiya, maybe for the future, you should start thinking in a different approuch. Something like this:pastedImage_0.png

-------------------------------------------------------------------
Triple VCIX (CMA-NV-DCV) | vExpert | MCSE | CCNA
natiya2
Contributor
Contributor

thanks, guys!

NicolasAlauzet​ I see the option you suggest but at the moment, we don't have a switch.

Before we actually set the vSwitch, the vNIC and the port group, I'd like to make sure of these points, please:

1.- Do I need to assign a range of IPs to each physical adapter/vSwitch? Like this example:

vswitch.png

So this way, traffic coming out of the VM knows where to go even if the VM has 2 different vNICs and there are 2 vSwitch, each of them with a different port group?

2.- The existing vSwitch and vNICs, are connected to the management network that we use to access vSphere remotely. There are no more port groups or vNICs in that vSwitch. Anyway, do we need to give the IP address for management? I assume yes (it's configured like that already), but correct me if I'm wrong. Do we need to do this for the new vSwitch? I guess we don't need to provide an IP for that port group, but we need to configure it in the vSwitch pNIC, right? This is a screenshot of the settings I'm talking about:

port_group.png

3.- I read a bit about the type of adapters we can select for the vNIC here. Would it be ok to select "VMXNET 3" for this application?

adapter.png

MANY THANKS!!

Hi there!

1- No, you don't need to assign ip ranges or anything else to the uplinks (that information is dinamically populated)

2- There is not need to add a Management Kernel or any other kind of vmkernel. (Those are used to access and manage the ESXi for example)

Just New Switch, assign the Uplink (the pNIC), create a portgroup and assign it to the VM.

3- VMXNET 3! when supported, you should use that adapter (Drivers are installed with the vmware tools)    

What is VMXNET Generation 3 (VMXNET3)? - Definition from WhatIs.com

Hope that helps!

-------------------------------------------------------------------
Triple VCIX (CMA-NV-DCV) | vExpert | MCSE | CCNA
natiya2
Contributor
Contributor

NicolasAlauzet​ let me try it and I'll tick your answer as correct! Smiley Happy