Skip to content
System

Configure the network of a Debian 13 VM on Hyper-V

Avatar illustré de Julien Macé 5 min read
Serveur relié à un commutateur virtuel et à une machine Debian dans Hyper-V
La carte physique, le commutateur virtuel et la VM doivent appartenir au même chemin réseau.

The VM starts, Debian 13 is installed, but it remains invisible from the network. Either the address changes after moving the Hyper-V host. In both cases, avoid modifying Debian randomly: the cut may be on the virtual card, the switch, or the guest interface.

The network of a Debian 13 VM under Hyper-V is read from the outside in: Hyper-V card, virtual switch, host network, and then interface and route in Debian. If the VM is not yet created, start with the Hyper-V VM and its Debian 13 installation. Otherwise, note each layer before changing it.

n
Server connected to a virtual switch and a Debian machine in Hyper-V
The physical card, the virtual switch, and the VM must belong to the same network path.
n

Read the Hyper-V switch before Debian

From PowerShell opened as administrator on the Windows host, note the switch, the card, and the currently used MAC address.

Get-VMSwitch
Get-VMNetworkAdapter -VMName "<vm-name>" | Format-List *

Get-VMSwitch indicates the type of switch: External, Internal, or Private. The second command lists the properties of the VM’s card. Keep the switch name and MAC in your notes before making any changes. An absent IP address in the host-side output does not prove that Debian does not have one: check the address in the guest.

The type of Hyper-V network card cannot be changed after the VM is created. If a legacy card has been added by mistake, I prefer to keep the specific Hyper-V adapter and remove the old one, unless there is a real need for network booting. For a switch type change, notify other connected VMs: they will all be affected.

Choose the switch according to the machines to connect

The switch answers a simple question: who needs to talk to the VM, and who will give it an address? This is the decision to make before editing a Debian file.

SwitchAccessIP AddressUsage
ExternalVM and physical networkLocal network DHCP, generallyVM reachable on the LAN
InternalVM and hostTo be provided by your configurationExchanges with Windows or between local services
PrivateVMs among themselvesTo be provided in the guestsNetwork isolated from other layers
Internal NATVM to the outside via the hostAddress, gateway, and DNS to be set in the VMControlled exit without direct exposure

WinNAT does not distribute an address to VMs on its own. For an internal NAT network, Microsoft documents the creation of the switch and the gateway, followed by the manual configuration of the guest. The values below are examples: replace the index found on your host.

New-VMSwitch -Name "LEC-NAT" -SwitchType Internal
Get-NetAdapter
New-NetIPAddress -IPAddress 192.168.50.1 -PrefixLength 24 -InterfaceIndex <ifIndex-of-vEthernet>
New-NetNat -Name "LEC-NAT" -InternalIPInterfaceAddressPrefix 192.168.50.0/24
Get-NetNat

Get-NetAdapter should help you identify vEthernet (LEC-NAT) and its ifIndex. Get-NetNat then reads the created network. Currently, only one NAT network is possible per host according to Microsoft documentation: if a NAT already exists, do not add a second one.

Confirm the synthetic adapter in Debian

In Debian 13, start by reading the real name of the interface. Do not automatically replace this name with enp1s0: it serves here as an example for the last two commands.

ip -brief link
ip -brief addr
ethtool -i enp1s0
lsmod | grep -E 'hv_netvsc|hv_vmbus'
dmesg | grep -i -E 'hv_netvsc|hv_vmbus'

ip -brief link should show an Ethernet interface in addition to lo. With the real name, ethtool -i should indicate the driver hv_netvsc, which is for the Hyper-V synthetic card. You can also check the link status and driver with ethtool.

The support for Linux Integration Services is integrated into the distribution documented by Microsoft. Do not install the Microsoft LIS package, and do not run apt install hyperv-daemons as a network fix: these daemons do not provide the IP address. If an old legacy card is also connected, remove it after noting the configuration, as Microsoft reports inconsistent interface names in this case.

Check the address, route, and DNS

On an external switch, the address normally comes from the local network DHCP. The Debian installer uses DHCP by default to probe the network. Perform checks in this order, without stacking changes.

ip -brief addr
ip route
cat /etc/resolv.conf
ping -c 3 <gateway-seen-in-ip-route>
ping -c 3 1.1.1.1
getent hosts deb.debian.org

You are looking for an address in the correct prefix, a default via line, a reachable gateway, then a response to an IP address and finally a resolved name. No address indicates a problem with assignment or network manager. A reachable gateway without external access points to the route or NAT. An IP address that responds without resolution goes back to DNS; test DNS resolution with dig to refine this last check.

Set the address in the guest when DHCP is not enough

On an internal or NAT switch, the host does not automatically give an address to Debian. The Microsoft matrix does not check the injection of a static IP for Debian. The address, gateway, and DNS must therefore be consistent in the guest.

systemctl is-active NetworkManager
systemctl is-active systemd-networkd

These two commands show which service is active. NetworkManager is not installed by default on a minimal Debian server. I advise you to set the address only after this check, then follow the fixed IP address method on Debian suitable for the present manager. If the VM is only accessible via SSH, open a second session or keep the Hyper-V console open before reloading the network, then restore the backed-up file if the connection drops.

Stabilize the MAC only for a host change

A test VM usually does not need a fixed MAC. The setting becomes useful when changing hosts, in a failover cluster, or with a DHCP reservation linked to the MAC.

Get-VMNetworkAdapter -VMName "<vm-name>" | Format-List *
Set-VMNetworkAdapter -VMName "<vm-name>" -StaticMacAddress "00155D012345"
Get-VMNetworkAdapter -VMName "<vm-name>" | Format-List *

Note the MAC before the action, then compare the value read after. Replace the example with a valid address and keep the original value to revert to the previous configuration. The parameter -DynamicMacAddress allows you to go back to automatic assignment. MAC spoofing relates to another need, such as routing or nested virtualization.

Stop at the failing check

Here is the final check, from the host to Debian:

  • the Hyper-V card is attached to the expected switch;
  • the read MAC matches the noted or chosen value;
  • ip -brief addr shows the expected interface and address;
  • ip route contains a default route;
  • the gateway responds and a Debian name resolves.
udevadm test-builtin net_setup_link /sys/class/net/enp1s0 2>/dev/null

In this last command, replace enp1s0 again with the real name. The line ID_NET_NAME indicates the name that Debian 13 would apply. If this name differs, the Trixie release notes provide for a systemd.link file to lock it before a reboot.

Warning: Debian 13 does not appear in the Microsoft matrix of Debian VMs, which stops at Debian 12. This text therefore does not cover the guest firewall, nor IPv6, nor integration services. If the card, the switch, the route, and the DNS are consistent, stop the network modification and move on to diagnosing the concerned service.

Share Facebook X WhatsApp LinkedIn Pinterest Reddit Email