June 5, 2023

Implementing Hyper-V virtual networks routing with Netgate pfSense 2.6.0

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

Welcome to the next installment of our series on virtual switches and routing in Hyper-V. In this post, we will explore another powerful routing option: implementing virtual network routing with Netgate pfSense 2.6.0. As part of this series, we aim to provide you with a comprehensive understanding of different routing possibilities in Hyper-V, empowering you to make informed decisions when configuring your virtualized network environments.

Routing is a critical component of virtualized environments, enabling communication between virtual networks and external networks. Netgate pfSense, renowned for its feature-rich capabilities and robust routing functionalities, serves as an excellent choice for virtual network routing in Hyper-V. In this post, we will focus on Netgate pfSense version 2.6.0 as a solution for routing between virtual networks within Hyper-V.

On this page

Let’s begin.


Technology Overview

The pfSense project is a free network firewall distribution, based on the FreeBSD operating system with a custom kernel and including third party free software packages for additional functionality. pfSense software, with the help of the package system, is able to provide the same functionality or more of common commercial firewalls, without any of the artificial limitations. It has successfully replaced every big name commercial firewall you can imagine in numerous installations around the world, including Check Point, Cisco PIX, Cisco ASA, Juniper, Sonicwall, Netgear, Watchguard, Astaro, and more.

pfSense software includes a web interface for the configuration of all included components. There is no need for any UNIX knowledge, no need to use the command line for anything, and no need to ever manually edit any rule sets. Users familiar with commercial firewalls catch on to the web interface quickly, though there can be a learning curve for users not familiar with commercial-grade firewalls.


Solution Overview

  • Our Hyper-V has 3 Virtual Switches:
  • LAB (External): connected to External network (physical NIC/network connection), with access to the Internet, allowing management operating system to share that network adapter. IP configuration is automatically set by DHCP in that physical network.
  • Virtual Machines are connected to private networks Private 1 (A) and Private 2 (B).
  • Network segmentation must be preserved.
  • Flexible network topology is required, so additional virtual networks can be added later.
  • Interconnectivity between Private Networks, and with the hypervisor (Hyper-V) host needs to be established.
  • Virtual Machines connected only to private networks require accessing the Internet to download updates

Solution Blueprint


System Requirements

  • Hyper-V Host: if you do not have it installed yet, you can find how to do it on Step-By-Step: Turning on Hyper-V on Windows 11
  • pfSense Community Edition 2.6.0 DVD (ISO) image (download): it supports the x86 64-bit architecture and can be used on most of the popular hypervisors such as VMWare, Hyper-V, VirtualBox, KVM, and others.
  • 7-zip (download): a software that can compress and decompress files in various formats.
  • Host CPU: 64-bit compatible CPU
  • RAM: 512MB or more
  • Disk: 8GB disk space
  • At least one compatible network interface (1 interface isn’t very practical)

The bare minimum to run pfSense is 512 MB of RAM. The recommended amount is 1 GB of RAM. We wouldn’t recommend running pfSense on 512 MB RAM in any serious project.


Implementation

For this exercise, we created a Hyper-V virtual machine with the following configuration:
Name: RT-PFSENSE260-01
Generation: Generation 2
BIOS: Startup order: Hard Drive, DVD Drive, Network Adapters
Security: Secure Boot DISABLED
Memory: 1024 MB
Processor: Number of virtual processors: 2
SCSI Controller: Hard drive (10GB, Dynamically expanding) / DVD Drive
Network Adapters:
1) Connected to Virtual Switch LAB (External)
2) Connected to Virtual Switch LAB (Private A)
3) Connected to Virtual Switch LAB (Private B)

  • 1. On your lab machine running Hyper-V, access "https://www.pfsense.org/download/" in a browser, select the architecture "AMD64 (64-bit)", installer "DVD Image (ISO) Installer" and mirror closer to your region, and click "Download"

Testing and Validation

  • 1. Make sure you are on a machine connected only to "Private A" virtual switch by typing the following commands and pressing "Enter" after them: "[Environment]::MachineName" and "Get-NetIPConfiguration", validating your network configuration. Command "Invoke-RestMethod -Uri http://ipconfig.me" should return your external IP address if routing is working properly and machine now has access to the internet.

Bottom Line

In this post, we have delved into the implementation of virtual network routing using Netgate pfSense 2.6.0 in Hyper-V. We encourage you to explore and experiment with these concepts in your own virtualized network environments. Your hands-on experience will enhance your understanding of how pfSense can elevate your network routing capabilities.

We greatly appreciate your feedback and value your input. If you have any questions, encounter challenges, or need further clarification, please don’t hesitate to reach out to us. Your feedback not only helps us improve this series but also contributes to the broader knowledge-sharing community.

Stay tuned for the upcoming posts in this series, where we will continue to explore various routing options in Hyper-V. We will provide practical examples and detailed discussions to further expand your knowledge and empower you to optimize your virtual network architecture.

Remember, with virtual switches and routing in Hyper-V, you have the ability to create resilient and efficient network infrastructures. Let’s continue this journey together, learning, implementing, and unlocking the full potential of Hyper-V’s routing capabilities using Netgate pfSense 2.6.0.

Series Navigation