June 5, 2023

Virtual switches and routing in Hyper-V – Overview and Summary

By Roger Carvalho
This entry is part [part not set] of 3 in the series Virtual switches and routing in Hyper-V

Virtual Switches in Hyper-V are software-based networking components that enable communication between virtual machines (VMs) and the external network or other VMs within the Hyper-V host. Acting as a virtual network device, the Virtual Switch connects the VMs to the physical network infrastructure. It provides a bridge between the virtual and physical worlds, facilitating data transmission and network connectivity.

By leveraging Virtual Switches, administrators can establish flexible and scalable networking architectures within the Hyper-V environment. They can create virtual networks, segment workloads, and apply network policies to ensure optimal performance, security, and management control. Virtual Switches are a crucial component in building robust and efficient virtual infrastructures in Hyper-V.

On this page:

Let’s begin.


Hyper-V Virtual Switches

Hyper-V Virtual Switches can be configured to operate in three different modes, each with distinct characteristics and use cases:

  1. External Virtual Switch:
    • Characteristics: An external virtual switch is connected to a physical network adapter on the Hyper-V host. It enables communication between virtual machines (VMs) and the external network infrastructure.
    • Use Case: This type of virtual switch is commonly used when VMs need to connect to the external network or access resources outside the Hyper-V host, such as internet connectivity or communication with other physical servers.
  2. Internal Virtual Switch:
    • Characteristics: An internal virtual switch facilitates communication between VMs on the same Hyper-V host. It does not have a connection to the physical network and is isolated from external networks.
    • Use Case: Internal virtual switches are useful when you want to establish communication and networking between VMs running on the same host while isolating them from external networks. This is beneficial for creating private or internal networks within the Hyper-V environment.
  3. Private Virtual Switch:
    • Characteristics: A private virtual switch enables communication solely between VMs on the same Hyper-V host. It does not have any connection to the physical network, and communication is restricted to VMs within the private virtual switch.
    • Use Case: Private virtual switches are suitable when you want to create isolated network environments for specific VMs. This type of virtual switch is commonly used for testing, development, or sandboxing purposes, where VMs need to communicate with each other but remain isolated from the external network.

By leveraging these different types of virtual switches in Hyper-V, administrators can design and configure networking setups that meet specific requirements, ensuring efficient communication and network management within their virtual infrastructure.


Routing in Hyper-V

Having a router between virtual networks in Hyper-V offers several advantages:

  • Network Segmentation: By deploying a router between virtual networks, you can divide your infrastructure into separate segments or subnets. This enables you to logically isolate different departments, projects, or workloads within your virtual environment. Segmentation enhances security, improves performance, and provides better management control.
  • Improved Network Performance: A router allows for efficient traffic routing between virtual networks. It can prioritize network traffic, apply Quality of Service (QoS) policies, and optimize routing decisions based on network conditions. This helps to improve network performance, reduce latency, and ensure smooth data transmission between virtual machines.
  • Enhanced Security: With a router in place, you can enforce firewall rules, access control policies, and implement Network Address Translation (NAT) to protect your virtual networks. The router acts as a security gateway, filtering traffic, and preventing unauthorized access between different network segments. This segregation enhances the overall security posture of your virtual environment.
  • Flexible Network Topology: A router provides flexibility in designing the network topology within Hyper-V. You can create complex network architectures, such as hub-and-spoke or mesh topologies, by connecting multiple virtual networks through the router. This enables efficient communication and data exchange between different segments while maintaining network scalability.
  • Interconnectivity with External Networks: By connecting the router to an external network interface, such as a physical network adapter or a virtual switch connected to the host’s physical network, you can establish connectivity between your virtual networks and the external world. This allows virtual machines to access resources outside the Hyper-V environment, such as the internet, other physical servers, or external services.
  • Simplified Network Management: A router provides a centralized point for managing network traffic and configuration. You can configure routing protocols, set up VPN connections, and monitor network activity from a single location. This simplifies network management tasks and enhances overall administrative efficiency.

Some Routing options

You can choose between different options to implement routing in your Lab Hyper-V setup, installing and configuring different solutions on a dedicated virtual machine to act as a router between the internal and external networks:

Coming soon…

  • Implementing Hyper-V virtual networks routing with OPNsense 23.1
  • Implementing Hyper-V virtual networks routing with Smoothwall 3.1
  • Implementing Hyper-V virtual networks routing with VyOS 1.2.9
  • Windows Server 2022 VM with Routing and Remote Access
  • CentOS Stream 9 VM acting as a router between Hyper-V virtual networks
  • Fedora 38 VM acting as a router between Hyper-V virtual networks
  • OpenSUSE 15.4 VM acting as a router between Hyper-V virtual networks
  • Oracle Linux 9.2 VM acting as a router between Hyper-V virtual networks
  • Ubuntu 22.04 VM acting as a router between Hyper-V virtual networks
Series Navigation