Link to home
Create AccountLog in
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?)
Avatar of Ian Pattison
Ian Pattison
Flag of United Kingdom of Great Britain and Northern Ireland image

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.
Avatar of Michael Hemberger
Michael Hemberger

ASKER

So where do I go in the settings to give the VM the static IP?
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
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
Avatar of Ian Pattison
Ian Pattison
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Thanks!
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.
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!
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.
So ... Ian
Will VM to VM communication be hobbled?
Also what about Nic Teaming?
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.
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.
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?
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.
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?
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.
Be advised that Windows Server 2016 is dog slow at applying Windows Updates. Server 2019 and Exchange 2019 would be preferred.
One other question:

When creating the Virtual Switch...

Do I need to leave checked the "Allow management operating system to share this network adapter"?
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
Yes it does... so Yes or No to the last question?
The answer is no, to isolate the HOST feed from the VM feed.