Unable to Ping Hyper-V Host from Ubuntu VM: A Networking Issue

Abstract: Resolve inability to ping Hyper-V host from Ubuntu VM by configuring internal virtual switches and allowing ICMPv4 in Windows Firewall.

Created: 2026-08-19 by

When an Ubuntu virtual machine cannot ping its Hyper-V host, the issue typically stems from firewall rules blocking ICMP traffic or incorrect network adapter configurations. Resolving this requires verifying that the host’s Windows Defender Firewall allows incoming echo requests and ensuring the VM’s network switch is set to allow external communication.

Verify Network Adapter Configuration

The first step in troubleshooting connectivity between a Linux guest and a Windows host is to inspect the virtual network settings within Hyper-V Manager. By default, new virtual machines are often connected to a "Default Switch," which uses NAT (Network Address Translation) to provide internet access. While this setup allows the VM to reach the outside world, it does not guarantee direct Layer 3 connectivity back to the host IP address. To establish a direct path, you should consider creating an Internal Virtual Switch. This type of switch creates a private network between the host and the VM without exposing them to the physical network. In Hyper-V Manager, navigate to Virtual Switch Manager and create a new Internal switch. Assign this switch to your Ubuntu VM’s network adapter. Once configured, the VM and the host will share a common subnet, making routing simpler. If you prefer to keep the Default Switch, you must ensure that the host’s IP address is reachable. The Default Switch usually assigns IPs dynamically via DHCP. You can find the host’s IP address on the internal interface created by the Default Switch by running ipconfig in PowerShell on the Windows host. Look for the IPv4 address associated with the vEthernet (Default Switch) adapter. On the Ubuntu side, verify that the VM has obtained an IP in the same subnet using ip addr show. If the subnets do not match, the ping will fail regardless of firewall status. For more complex networking scenarios involving multiple VMs, configuring static routes might be necessary. If you have previously set up traffic routing between different guests, you may need to adjust these rules to include the host as a valid destination. For detailed guidance on managing traffic flows between virtual machines, see How to Configure a Traffic Route from VM1 through Host to VM2.

Check Windows Firewall Rules

Even with correct network configuration, the most common reason for ping failures is the Windows Defender Firewall blocking Internet Control Message Protocol (ICMP) packets. By default, Windows often blocks inbound ping requests to prevent unauthorized discovery of the machine. To test if the firewall is the culprit, temporarily disable the firewall on the host. Open PowerShell as Administrator and run:
Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False
After disabling the firewall, attempt to ping the host from the Ubuntu VM again. If the ping succeeds, you know the issue is strictly related to security policies. Do not leave the firewall disabled permanently; instead, create a specific rule to allow ICMPv4. To create an allow rule, use the following command in PowerShell:
New-NetFirewallRule -DisplayName "Allow ICMPv4" -Protocol ICMPv4 -IcmpType 8 -Enabled True -Action Allow
This rule explicitly permits echo requests while keeping other ports protected. If you are using third-party antivirus software, check its firewall module as well, as it may override Windows settings. Some users find success by assigning static MAC addresses to their VMs to prevent ARP conflicts, though this is rarely the primary cause of ICMP blockage.

Validate Ubuntu Network Settings

On the Ubuntu side, ensure that the network manager is correctly handling the interface. Modern versions of Ubuntu use Netplan for network configuration. Check the status of your network interface using nmcli device status. Ensure the interface is listed as "connected." Sometimes, residual configurations from previous network setups can interfere. If you recently changed from one virtual switch to another, the old DHCP lease might still be active. Restarting the network service can clear stale states:
sudo systemctl restart systemd-networkd
Or, if you are using NetworkManager:
sudo systemctl restart NetworkManager
It is also worth checking if the Ubuntu kernel has any restrictive modules loaded. Run sysctl net.ipv4.icmp_echo_ignore_all. If this returns 1, the system is configured to ignore all ping requests. Change it to 0 with sudo sysctl -w net.ipv4.icmp_echo_ignore_all=0 to restore functionality.

Troubleshooting Advanced Connectivity

If basic pings work but general connectivity fails, there may be deeper routing issues. Unlike standard bridged networks where the host acts as a gateway, Hyper-V internal switches require explicit routing if you want the VM to communicate with other subnets. However, for host-to-VM communication, simple layer 2 adjacency is usually sufficient. In cases where you are trying to forward traffic or connect to external services, port forwarding might be required. While OpenVPN provides robust tunneling capabilities, it is often overkill for simple host-VM communication. If you are experimenting with VPNs for remote management, refer to Port Forwarding VM via OpenVPN: A Comprehensive Guide for advanced tunneling techniques. Another common pitfall is DNS resolution. Pinging by IP address bypasses DNS, so if ping <host-ip> works but ping <hostname> fails, the issue is name resolution. Ensure that the host’s hostname is registered in the local DNS or hosts file on the Ubuntu VM. Editing /etc/hosts to include the host’s IP and name is a quick fix for this specific symptom.

Frequently Asked Questions

Why can my Ubuntu VM ping the internet but not the host?

This indicates that the Default Switch is functioning correctly for outbound traffic, but the return path or local firewall is blocking the host. The host’s Windows Firewall is likely blocking inbound ICMP requests, or the VM is on a NATted subnet that does not route directly to the host’s internal interface.

Does disabling the firewall make the VM insecure?

Temporarily disabling the firewall is safe for diagnostic purposes only. It exposes all open ports on the host to the VM. Always re-enable the firewall immediately after testing and configure specific allow rules for ICMP and any required services like SSH or RDP.

What is the difference between Default Switch and Internal Switch?

The Default Switch uses NAT to give the VM internet access through the host, hiding the VM from the physical network. An Internal Switch creates a private LAN between the host and VMs, providing direct IP connectivity without internet access unless routed explicitly.

Can I use a Bridged Adapter instead?

Yes, a Bridged Adapter connects the VM directly to the physical network interface. This gives the VM its own IP on the LAN, allowing it to ping the host if they are on the same subnet. However, this may cause IP conflicts if the DHCP server assigns an address already in use.

How do I find the host IP from inside Ubuntu?

You can discover the host’s internal IP by checking the gateway or looking at the neighbor table. On the Windows host, run ipconfig and look for the vEthernet adapter IP. Alternatively, from Ubuntu, you can try pinging the broadcast address of your subnet if enabled.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More