Hyper-V: Accessing LAN Devices on Host

Abstract: Resolve Hyper-V Ubuntu VM LAN access issues by configuring an external virtual switch and adjusting firewall rules.

Created: 2026-10-20 by

Accessing LAN devices from a Hyper-V host while running Ubuntu virtual machines requires careful network adapter configuration. By properly configuring the external virtual switch and ensuring routing rules are in place, you can enable seamless communication between your Linux web service, the Windows host, and other devices on your local network.

Understanding Network Adapter Types

Hyper-V provides several types of virtual network adapters that determine how your virtual machine connects to the physical network. The most common options are External, Internal, and Private switches. For accessing LAN devices, the External switch is typically the required choice because it binds directly to a physical network interface card (NIC) on the host machine. This allows the virtual machine to appear as a distinct device on the same subnet as the host. When you create an External switch, Hyper-V creates a virtual switch that bridges the traffic between the VM and the physical NIC. It is crucial to select the correct physical adapter, especially if your host has multiple network interfaces, such as Wi-Fi and Ethernet. If you choose the wrong adapter, your VM may not receive an IP address from your router, or it may be isolated from the rest of the LAN. Always verify that the physical adapter you select is connected to the network segment containing the devices you wish to access.

Configuring the Virtual Switch

To set up the connection, open Hyper-V Manager and navigate to Virtual Switch Manager. Select New virtual network switch and choose External. In the subsequent wizard, select the physical network adapter that provides internet access or LAN connectivity. You will see an option to allow management operating system to share this network adapter. Checking this box is essential for the host to retain its own network connectivity while the VM uses the adapter. Without this setting, the host may lose its network connection entirely when the VM starts. Once the switch is created, assign it to your Ubuntu VM. Go to the VM settings, locate the Network Adapter section, and change the connection type from Default Switch to the newly created External switch. Restart the VM to apply the changes. Upon booting, Ubuntu should automatically request an IP address via DHCP from your local router. You can verify this by running ip addr show in the terminal. Look for an IP address in the same range as your host computer, typically something like 192.168.1.x or 10.0.0.x. NIC Change VM (Ubuntu Hyper-V) Default Switch - External Switch Lost Internet Connection This step often resolves issues where VMs lose connectivity after switching from the default NAT-based switch. The default switch isolates the VM from the LAN, making direct access to other devices impossible without complex port forwarding or proxy configurations.

Firewall and Service Configuration

Even with the correct network switch, firewalls can block access to services running on the Ubuntu VM. Ubuntu uses UFW (Uncomplicated Firewall) by default. If your web service is listening on a specific port, ensure that UFW allows inbound traffic on that port. You can check the status of the firewall using sudo ufw status. If the status is active, you must add a rule to allow incoming connections, such as sudo ufw allow 80/tcp for HTTP traffic. On the Windows host side, the Windows Defender Firewall might also interfere, although it rarely blocks outbound connections initiated by the host to the VM. However, if you are trying to access the VM from another device on the LAN, that device's firewall must also permit the connection. Ensure that your web service is bound to the correct interface. Binding to 0.0.0.0 ensures the service listens on all available network interfaces, including the one connected to the virtual switch. Binding to 127.0.0.1 would restrict access to localhost only, preventing remote LAN access.

Testing Connectivity

After configuring the switch and firewalls, test the connectivity from the Windows host. Open a command prompt and use ping followed by the VM's IP address. A successful ping confirms basic network layer connectivity. Next, try accessing the web service using curl http://<VM_IP>:<port>. If the curl command returns the expected response, your configuration is successful. If it times out, re-check the UFW rules and ensure the service is actually running and listening on the correct port using ss -tlnp. Routing Windows Traffic through Linux using Socks Proxy While a SOCKS proxy is useful for routing general traffic, it is not necessary for simple LAN access to a web service. Direct IP access is more efficient and simpler to debug. However, if you need to route specific application traffic through the Linux VM, consider using SSH tunneling instead of a full proxy setup.

Troubleshooting Common Issues

If you cannot reach the VM, first verify the IP address. Sometimes DHCP leases expire or conflict. Setting a static IP within the DHCP range of your router can prevent these issues. Ensure that the static IP does not conflict with any other device on the network. Additionally, check the MAC address of the VM's network adapter in Hyper-V settings. Some routers have MAC filtering enabled, which could block the VM from obtaining an IP address. Another common issue is asymmetric routing. If your host has multiple network adapters, packets sent from the VM might return through a different interface than they were sent. This can cause connection drops. To mitigate this, ensure that all devices on the LAN are reachable through the same primary gateway. Disabling unused network adapters on the host can simplify the routing table and reduce confusion for the hypervisor.

Frequently Asked Questions

Can I access the VM from my phone on the same Wi-Fi?

Yes, provided the VM is connected to an External switch bound to the same physical adapter your phone uses. Your phone and the VM must be on the same subnet. If your Wi-Fi and Ethernet are on different subnets, you may need to configure routing between them on the host.

Why did my host lose internet after creating the switch?

You likely unchecked the "Allow management operating system to share this network adapter" option during switch creation. Reopen the Virtual Switch Manager, edit the switch, and check that box again. Then restart the network adapter on the host to restore connectivity.

Is it safe to expose my Linux web service to the LAN?

It is generally safe if you use strong authentication and keep the software updated. However, exposing services to the LAN increases the attack surface compared to localhost-only access. Always use HTTPS and restrict access to trusted IP ranges if possible using firewall rules.

What if I need multiple VMs to access different LAN resources?

You can create multiple External switches, each bound to a different physical NIC, if your host has multiple network cards. Alternatively, use VLAN tagging on the virtual switch to segment traffic logically without needing separate physical adapters.

How do I find the VM's IP address if DHCP fails?

Check the DHCP server logs on your router to see if the VM requested an address. You can also try assigning a static IP manually in Ubuntu's netplan configuration files, ensuring it falls outside the router's DHCP pool to avoid conflicts.

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