How to configure the network on Hyper-V virtual machine on dedicated servers
This guide covers network configuration for virtual machines running on Hyper-V on Servers.com dedicated servers, including virtual switch setup and network interface configuration inside the guest OS.
Setting up and installation of virtual machines
Setting up
When setting up virtual machines on Hyper-V, include the aggi interface in the virtual switch and configure a free IP address on the virtual machine, specifying the main gateway of the physical server's public network.
Installation
Instructions on how to install Hyper-V and create a virtual machine can be found on the official Microsoft website:
- Installing the Hyper-V role on Windows Server
- Creating a virtual switch for Hyper-V virtual machines
- Creating a virtual machine in Hyper-V
Creating vSwitch
Starting with Windows Server 2016, the LBFO (Load Balancing/Failover) teaming method is outdated and not recommended for Hyper-V.
When creating a vSwitch for Hyper-V via the GUI, you might encounter an error. This can be bypassed by creating the vSwitch through PowerShell with the -AllowNetLbfoTeams $true parameter:
New-VMSwitch -Name "vSwitch" -NetAdapterName "aggi" -AllowNetLbfoTeams $trueNetwork configuration examples
CentOS 7
/etc/sysconfig/network-scripts/ifcfg-eth0
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
NAME=eth0
DEVICE=eth0
ONBOOT=yes
IPADDR=188.42.29.222
PREFIX=32
GATEWAY=188.42.128.203
DNS1=8.8.8.8Where:
IPADDR– any available IP address in the range assigned to the dedicated server (can also be an alias IP)PREFIX– the subnet mask of the IP address range (can be /32 for an alias IP)GATEWAY– the IP address of the gateway in the public network
Ubuntu
/etc/netplan/00-installer-config.yaml
network:
ethernets:
eth0:
addresses:
- 188.42.29.222/32
gateway4: 188.42.128.203
nameservers:
addresses: [8.8.8.8, 1.1.1.1]
search: []
version: 2/etc/network/interfaces
iface eth0 inet static
address 188.42.29.222
mask 255.255.255.255
gateway 188.42.128.203Where:
- Address: any available IP in the range assigned to the dedicated server (can also be an alias IP)
- Mask: the subnet mask (255.255.255.255 for a /32 alias IP)
- Gateway: the IP address of the gateway in the public network