Forum Discussion
Assign IP Address for Windows Server 2025 VM on Hyper-V
I have built my first Windows Server 2025 VM on HyperV and trying to assign an IP address. I want the VM's to be like an actual server so I Created an external vswitch. The HyperV server IP is 172.16.1.41 with a physical gateway of 172.16.1.5. I have tried to assign the new VM with 172.16.1.42/255.255.255.0 and the Gateway is 172.16.1.5 also. However, I cannot get a positive ping. Do I need another VSWITCH configured or what am I missing?
4 Replies
You do not need a second virtual switch. One external Hyper-V switch can connect the host and VM to 172.16.1.0/24. Confirm the VM adapter is attached to that switch, the switch is bound to the correct physical NIC, and Allow management operating system to share this network adapter is enabled if the host uses that NIC. In the guest, verify 172.16.1.42, mask 255.255.255.0, gateway 172.16.1.5, and DNS, then confirm the address is unused. Test the guest address, host, and gateway in that order. Check the VM adapter’s VLAN setting; leave it untagged unless the physical switch requires a specific VLAN. Windows Firewall may block inbound ping, so also test outbound connectivity from the guest. If the gateway remains unreachable, inspect the physical switch for port security or MAC-address limits, because Hyper-V places the VM’s MAC behind the host port.
- Mike_GarczynskiTin Contributor
Test Reply
- Mike_GarczynskiTin Contributor
on the Hyper-V, if I issue ipconfig /all I get this output which indicated that the 172.16.1.41 IP is associated with Adapter #2
Ethernet adapter vEthernet (Virtual Switch):
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Hyper-V Virtual Ethernet Adapter
Physical Address. . . . . . . . . : D4-04-E6-0E-A2-87
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . : fe80::a334:5bd:24d:d2b3%19(Preferred)
Autoconfiguration IPv4 Address. . : 169.254.142.53(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.0.0
Default Gateway . . . . . . . . . :
DHCPv6 IAID . . . . . . . . . . . : 416548070
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-2D-D9-50-A2-D4-04-E6-0E-A2-87
NetBIOS over Tcpip. . . . . . . . : Enabled
Ethernet adapter Slot4 Port 1:
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Broadcom 5719 1GbE RJ45 4-port OCP Ethernet Adapter #2
Physical Address. . . . . . . . . : D4-04-E6-0E-A2-86
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . : fe80::b50d:7748:f233:237c%3(Preferred)
IPv4 Address. . . . . . . . . . . : 172.16.1.41(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 172.16.1.5
DHCPv6 IAID . . . . . . . . . . . : 181667046
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-2D-D9-50-A2-D4-04-E6-0E-A2-87
DNS Servers . . . . . . . . . . . : ::1
172.16.1.41
66.187.177.13
66.187.178.13
NetBIOS over Tcpip. . . . . . . . : Enabled
- Mike_GarczynskiTin Contributor
Thanks for the update. So as best as I can tell, the correct nic is being used for the physical connection to the network. There are 4 on the server and I am using 1. In the standard hardware configurations and in Hyper-V, they are the same. The Hyper-V server was originally configured with the 172.16.1.41 IP. After creating the External V-Switch, the IP address for the server is now 169.254.95.120. I remember reading that this would occur during installation and the IP would transfer to the Virtual Switch. I am able to ping 172.16.1.41 and 169.254.95.120 successfully, however, I don't see it in a 172.16.1.41 in the Hyper-V configuration anywhere. I do know the physical switch has no port security or mac limitations at this time. When I start 172.16.1.42, the VM Starts without issue. However, I cannot ping either of the other addresses.