Avatar of Michael Hemberger
Michael Hemberger
 asked on

How to use 2 port ethernet card with Hyper-V VM's and static ip

I'm creating two Hyper-V  VM's.  One for AD and one for Exchange.
The underlying OS is Server 2016 Standard.

I've installed the first VM with Server 2016 in prep for AD first before Exchange.

I have one built in Gigabit Ethernet port and I have installed a Ethernet card that has two ethernet ports.

What I don't know is how to use that 2 port Ethernet card with each having a static ip for the two VM's and how that all plays into the Virtual Switch (if it does?)
ExchangeOperating SystemsHyper-VActive Directory

Avatar of undefined
Last Comment
arnold

8/22/2022 - Mon
Ian Pattison

You don't assign a static IP to the ethernet ports at all.

Create two additional Virtual Switches in Hyper-V Manager, and attach each to its own ethernet port.  Untick the checkbox "Allow host operating system to access using this..." and ignore the warning that you may disconnect the server if you proceed. Creating the virtual switch with no Host access removes the binging to IPv4 and IPv6, so the virtual switches won't have their own IP addresses at all.

When you create your VMs, connect each to its own dedicated virtual switch, and give the VM the static IP, like you would with a physical device.
Michael Hemberger

ASKER
So where do I go in the settings to give the VM the static IP?
Ian Pattison

Exactly the same place as you would on a physical device.

You install the operating system (VM), and within the operating system you set the IP Address of the network interface (Which is connected to the virtual switch).

e.g. you may have:
1 x HOST (the actual hardware) with IP Address 192.168.1.10
1 x VM (a Virtual Machine) which is a DC with the IP Address of 192.168.1.20 set within the VM itself
1 x VM (a Virtual Machine) which is an Exchange Server with the IP Address of 192.168.1.25 set within the VM itself.

I've attached a screenshot of how you set a static IP Address.
Example-IP-Settings.JPG
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Michael Hemberger

ASKER
So... I think I see what your saying...
Let me talk it thru and see if you agree...

On my Server that has Server 2016 Standard installed on it and that license lets me have two additional licenses, one of which I used to:

Used hyper-v manager to create a VM
On that VM I have installed Server 2016 (haven't gotten to the AD yet)
In the network card interface settings for the VM with 2016 installed, I need put in my statice IP address in ipv4 settings.

Then I need to create Virtual Switch that  for it that points to that additional ethernet card with two ports in it and choose one of those ethernet ports (I can see they do show up to allow me to choose one for the Virtual Switch). Uncheck that box for "Allow host operating system..."

How does that sound?

Now when I created another VM and put Exchange 2016 on it, I need to set that static ip in the ipv4 settings for Exchange.
Once that's done, I create another Virtual Switch, choose the other ethernet port on my 2 port card and uncheck the box for "Allow host operating system..."

Right?
ASKER CERTIFIED SOLUTION
Ian Pattison

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Michael Hemberger

ASKER
Thanks!
kevinhsieh

You should not have multiple virtual switches, and certainly not each VM on it's own virtual switch.

How will you be doing backups?

How large is your environment?

The best option might to have 1 physical NIC connected to your physical switch, and have 1 virtual swith that the host and all VMs use. That virtual switch will use the 1 physical NIC

Other option is host use 1 NIC and virtual switch use second NIC.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Ian Pattison

If the OP is using a dedicated NIC per vm  because (for example) he hasn’t got a 10gbit NIC so wants a dedicated 1gbit to each VM then there is no problem with this at all.

I do t see the relevance of backups to your argument.

I agree, this can all be done with a single NIC, but that is not what was asked!
kevinhsieh

VM to VM communication is hobbled by putting each VM on a separate virtual switch. OP is also a Hyper-V noob, hence the general recommendation to use standard practice of all VMs on a single virtual switch.
Michael Hemberger

ASKER
So ... Ian
Will VM to VM communication be hobbled?
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
Michael Hemberger

ASKER
Also what about Nic Teaming?
kevinhsieh

What about NIC teaming? Why do you think it might be helpful?

Do you have redundant switches? If you do, then NIC teaming allows the host and/or VMs to communicate with the physical network even if a switch is down.

This is only helpful if other things also can communicate if a switch is down.

Do you have need for more aggregate bandwidth than what a single physical NIC can provide to your host and VMs? What is that need? A single TCP stream will not ever exceed the bandwidth of a single NIC. If you're thinking backups, is the source and destination storage fast enough to saturate a single NIC, and does the backup target also have NIC teaming to take advantage? Note that NIC teaming won't speed up backup or restore of a single object.

NIC teaming can be helpful, and is less likely to be harmful than some other technologies, but is likely of limited benefit to you and does add complexity.
kevinhsieh

A VM can communicate to the virtual switch very fast. The VM will say 10G, but in reality it is at the speed of the host's bus, so that is easily more than 40G.

Virtual switch to virtual switch communication happens over the physical network, so that is limited by the physical network.

Having a dedicated virtual switch per VM is a niche deployment option that should only be used if you really know what you're doing and can justify it as the better design.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Michael Hemberger

ASKER
So Kevin..
Given ONLY  the parameters below
No extrapolating on some other setup

Two VM’s on Server 2016 Standard
64 GB Ram
Plenty of Hard drive space with multiple drives and decent raid.


One VM for AD (10 users)
One VM for Exchange (Only used for calendars).

One Ethernet card with 2 ports and one built in Ethernet port

Question:

What’s the best configuration for the Virtual Switches and/or Static IP use?
kevinhsieh

Host has 1 NIC.
1 external virtual switch on another NIC not shared with host. Both VMs use that virtual switch. Each VM has 1 virtual NIC.

This is the simplest setup and the hardest to get into trouble with, as the host is unaffected by anything you do to the virtual switch.
Michael Hemberger

ASKER
And can I assume each VM ‘s operating system (server 2016 standard for the first vm and exchange 2016 for the second I should make those os’s a static IP address under ipv4?
Your help has saved me hundreds of hours of internet surfing.
fblack61
Ian Pattison

Yes that is correct - except exchange 2016 is not an operating system - you need Server 2016 which is the operating system on the second vm, and then install exchange 2016 on that.
kevinhsieh

Be advised that Windows Server 2016 is dog slow at applying Windows Updates. Server 2019 and Exchange 2019 would be preferred.
Michael Hemberger

ASKER
One other question:

When creating the Virtual Switch...

Do I need to leave checked the "Allow management operating system to share this network adapter"?
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
arnold

Presumably, your HOST has a dedicated nic separate and apart from the VM's NIC.
https://searchservervirtualization.techtarget.com/tip/How-to-improve-security-in-Hyper-V-virtual-networks
Michael Hemberger

ASKER
Yes it does... so Yes or No to the last question?
arnold

The answer is no, to isolate the HOST feed from the VM feed.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck