{"id":1901,"date":"2022-09-26T10:36:40","date_gmt":"2022-09-26T14:06:40","guid":{"rendered":"https:\/\/blog.danjoannis.com\/?p=1901"},"modified":"2024-04-11T19:46:29","modified_gmt":"2024-04-11T23:16:29","slug":"freebsd-pfsense-slow-network-with-hyper-v","status":"publish","type":"post","link":"https:\/\/blog.danjoannis.com\/?p=1901","title":{"rendered":"FreeBSD \/ pfSense slow network with Hyper-V"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/blog.danjoannis.com\/wp-content\/uploads\/2022\/09\/image-3.png\"><img loading=\"lazy\" decoding=\"async\" width=\"882\" height=\"405\" src=\"https:\/\/blog.danjoannis.com\/wp-content\/uploads\/2022\/09\/image-3.png\" alt=\"\" class=\"wp-image-1911\" srcset=\"https:\/\/blog.danjoannis.com\/wp-content\/uploads\/2022\/09\/image-3.png 882w, https:\/\/blog.danjoannis.com\/wp-content\/uploads\/2022\/09\/image-3-300x138.png 300w, https:\/\/blog.danjoannis.com\/wp-content\/uploads\/2022\/09\/image-3-768x353.png 768w\" sizes=\"auto, (max-width: 882px) 100vw, 882px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">For some reason, it took me way too long to find information about this issue &#8211; so I&#8217;m writing another article that will hopefully help some people.<\/p>\n\n\n\n<p class=\"has-text-align-center wp-block-paragraph\"><strong>IT Ticket # 1337<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Problem Description<\/strong>: Network performance through pfSense is extremely slow with Hyper-V<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Software Versions<\/strong>: pfSense 2.6.0 and Windows Server 2022 (August 2022 patches)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Steps Taken Already<\/strong>: Confirmed hardware TCP offload is disabled; confirmed hardware checksum disabled; confirmed MTUs were correct.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Solution<\/strong>: <span style=\"text-decoration: underline;\">Read on for the solution (hint: it&#8217;s a known driver bug, and for now only a workaround exists)<\/span><\/p>\n\n\n\n<!--more-->\n\n\n\n<h2 class=\"wp-block-heading\">Why am I using pfSense and Hyper-V?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">I like pfSense and use it teaching my students. Firewall concepts are universal, pfSense is powerful, and Hyper-V is a very capable hypervisor. This semester, I moved from pfSense 2.5.2 to 2.6.0 for both the lab infrastructure and the student systems. After the 2.6.0 installation, I immediately noticed the network performance through the firewall was atrocious! Speed tests were around 5 <em>Megabits<\/em> per second &#8211; how did we ever survive with DSL \ud83d\ude09<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">I moved from pfSense 2.5.2 to 2.6.0 [&#8230;] speed tests were around 5 <em>Megabits<\/em> per second<\/p>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">I followed the usual steps: Google search &#8220;pfsense is slow with Hyper-V&#8221;. Lots of posts about disabling hardware TCP offloading, hardware checksum, and so on &#8211; but these are already disabled so not the problem.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Next was to verify the speed when directly connected to the WAN (it was 400+ Mbps), verify the speed from the firewall itself (still slow), and finally delete and recreate all vSwitches and VMs &#8211; no change.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">There was a detour into MTUs (which was not the issue), and after 5 hours of searching and debugging I was no further ahead&#8230; until I somehow crafted the correct search query that found this gem on <a href=\"https:\/\/blog.nuvotex.de\/pfsense-2-6-on-hyper-v-with-low-throughput\/\">another Daniel&#8217;s blog<\/a>. Huge thanks to them for posting this and saving my bacon.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The solution was out there&#8230; months ago<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In that article from April 2022, the author describes that a bug exists between the latest FreeBSD 12.3 and Hyper-V&#8217;s implementation of software Receive Segment Coalescing (RSC) in Virtual Switches.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The impact? Fragmentation of small frames, which otherwise don&#8217;t need fragmentation, resulting is poor performance.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/blog.danjoannis.com\/wp-content\/uploads\/2022\/09\/image-2.png\"><img loading=\"lazy\" decoding=\"async\" width=\"545\" height=\"147\" src=\"https:\/\/blog.danjoannis.com\/wp-content\/uploads\/2022\/09\/image-2.png\" alt=\"\" class=\"wp-image-1907\" srcset=\"https:\/\/blog.danjoannis.com\/wp-content\/uploads\/2022\/09\/image-2.png 545w, https:\/\/blog.danjoannis.com\/wp-content\/uploads\/2022\/09\/image-2-300x81.png 300w\" sizes=\"auto, (max-width: 545px) 100vw, 545px\" \/><\/a><figcaption class=\"wp-element-caption\">All up to date it seems<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">The bug didn&#8217;t exist in pfSense 2.5.2 because it used FreeBSD 12.2.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In the latest pfSense 2.6.0, it is using FreeBSD 12.3.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">More specifically, the FreeBSD 12.3 driver for the Hyper-V virtual network adapter (hnX devices) <a href=\"https:\/\/reviews.freebsd.org\/D34507\">needs an update to disable RSC offloading (March 2022).<\/a> At the time of writing, it is unclear if this driver update is available in the FreeBSD 12.x stream.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The Workaround<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The workaround is simple, but not ideal: disable software RSC for the Virtual Switch in Hyper-V.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It is a quick, reversible command &#8211; and incurs no downtime or network interruption!<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Get-VMSwitch\nSet-VMSwitch -Name &lt;VirtualSwitchName&gt; -EnableSoftwareRsc $false<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Use the first command to list your virtual switches and their names, then apply the second command with the correct Virtual Switch Name to disable software RSC.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Results<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Within seconds, the switch disables software RSC and the network performance returns. <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/blog.danjoannis.com\/wp-content\/uploads\/2022\/09\/image.png\"><img loading=\"lazy\" decoding=\"async\" width=\"862\" height=\"321\" src=\"https:\/\/blog.danjoannis.com\/wp-content\/uploads\/2022\/09\/image.png\" alt=\"\" class=\"wp-image-1905\" srcset=\"https:\/\/blog.danjoannis.com\/wp-content\/uploads\/2022\/09\/image.png 862w, https:\/\/blog.danjoannis.com\/wp-content\/uploads\/2022\/09\/image-300x112.png 300w, https:\/\/blog.danjoannis.com\/wp-content\/uploads\/2022\/09\/image-768x286.png 768w\" sizes=\"auto, (max-width: 862px) 100vw, 862px\" \/><\/a><figcaption class=\"wp-element-caption\">Make sure to apply the command to all Virtual Switches used by pfSense<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">I have tabulated my own results here:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><em><strong>pfSense Version \/ Software RSC<\/strong><\/em><\/td><td><strong>Enabled<\/strong><\/td><td><strong>Disabled<\/strong><\/td><\/tr><tr><td><strong>2.5.2<\/strong><\/td><td>410 Mbps<\/td><td>440 Mbps<\/td><\/tr><tr><td><strong>2.6.0<\/strong><\/td><td>6.8 Mbps<\/td><td>430 Mbps<\/td><\/tr><\/tbody><\/table><figcaption class=\"wp-element-caption\">Test Results &#8211; Before and After Disabling Software RSC<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">In terms of raw throughput, the difference is night and day. There is even a modest improvement with the previous FreeBSD release, though we are probably within the accuracy tolerance of online speed tests.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Final Thoughts<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">I&#8217;m not sure why I had a hard time finding this information. We can all agree that Google has a knack for including &#8220;popular&#8221; results, not necessarily accurate results. Hopefully this article helps someone else with this issue!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For some reason, it took me way too long to find information about this issue &#8211; so I&#8217;m writing another article that will hopefully help some people. IT Ticket # 1337 Problem Description: Network performance through pfSense is extremely slow with Hyper-V Software Versions: pfSense 2.6.0 and Windows Server 2022 (August 2022 patches) Steps Taken [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1910,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[285,9,138],"tags":[346,347,109],"class_list":["post-1901","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-networking","category-software","category-work","tag-firewall","tag-performance","tag-server"],"_links":{"self":[{"href":"https:\/\/blog.danjoannis.com\/index.php?rest_route=\/wp\/v2\/posts\/1901","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.danjoannis.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.danjoannis.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.danjoannis.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.danjoannis.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1901"}],"version-history":[{"count":6,"href":"https:\/\/blog.danjoannis.com\/index.php?rest_route=\/wp\/v2\/posts\/1901\/revisions"}],"predecessor-version":[{"id":1948,"href":"https:\/\/blog.danjoannis.com\/index.php?rest_route=\/wp\/v2\/posts\/1901\/revisions\/1948"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.danjoannis.com\/index.php?rest_route=\/wp\/v2\/media\/1910"}],"wp:attachment":[{"href":"https:\/\/blog.danjoannis.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1901"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.danjoannis.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1901"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.danjoannis.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1901"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}