8

I have Hyper-V installed on my Windows 10 laptop and have configured a Ubuntu VM on it. Ubuntu network adapter is connected with the external virtual switch I have created. With this configuration I would expect that the host and the guest should get different IP address from DHCP server. However they are both getting the same IP and I can't pinpoint the cause. Below are the print screens of virtual switch, network adapters on host, host network status and guest network status.

Here it's the virtual switch configuration

The network adapters on the host

Host configuration. Notice MAC and IP

Guest configuration. Notice MAC and IP

Can anyone see what's wrong in this configuration? Also, what should I change so both the host and the guest get their own IP and are presented independetly on the network?

1
  • Please add the output of ipconfig /all to the post. Can the VM correctly see the network? What happens if you give the VM another static IP? Remark: I have had unexplained problems with external virtual switches, so I rather prefer setting the VMs to the physical adapter - less problems this way.
    – harrymc
    Oct 25 '16 at 11:24
6
+50

Some DHCP servers always assign the same IP address to the same MAC.

Since your upstream is a regular (non-WDS) Wi-Fi connection, it can only have one MAC address – not multiple. The only reason Windows even allowed you to put it into a bridge is that it performs L2 NAT (arpnat) for you, rewriting your VMs' packets on the fly.

8
  • Please explain, because I see the computer MAC as E4-A4-71-0A-DE-76 and the VM as 00:15:5d:01:67:00.
    – harrymc
    Oct 25 '16 at 10:54
  • 1
    The VM has its own MAC, yes – but the router doesn't see it. (Similar to how all your hosts have 192.168.x IPs, but the internet doesn't see them.)
    – user1686
    Oct 25 '16 at 10:58
  • 1
    Because there's a Wi-Fi connection in between. The VM's network adapter doesn't separately associate to the Wi-Fi AP, it has to piggyback on the host's existing association – and the Wi-Fi frames just don't have a separate field for the 'original' MAC address. The AP assumes that the device which did the Wi-Fi handshake is the the same that's sending packets.
    – user1686
    Oct 25 '16 at 11:37
  • 1
    Either use routing instead of bridging, or see if you can make the VMs include something like DHCP client-ID / DUID in the lease requests... If this were e.g. Linux, hacks involving the not-quite-standard "WDS-bridge" (aka "4addr") Wi-Fi connection mode might be possible, depending on AP.
    – user1686
    Oct 26 '16 at 16:21
  • 1
    @Albert: That's exactly what my answer says. See the link in the answer for details.
    – harrymc
    Oct 27 '16 at 16:02
3

You can fix this, by going inside the VM settings:

Network Adapter/Advanced Feature and then

either apply a static MAC or dynamic MAC, but then you need to

Enable MAC address spoofing.

To make sure that VM will use a dedicated and spoofed MAC to act like a real network device.

Enable MAC address spoofing:

enter image description here

1
0

Sharing a WiFi connection is problematic and should not be directly done.

You should create the virtual switch as Ethernet, then on the host in the Network and Sharing Center, bridge that virtual switch to the WiFi adapter.

For details, see my answer on this post.

If for some reason this does not work, you can :

  • Use cable, not WiFi, or
  • Give the VM a static IP address.
0

I had a similar problem only on a Windows 2016 server running hyper v - Unbuntu 18.04 server with a LEMP stack. I was having intermittent webserver problems at least 5 times a day and sometimes more where the server would just not respond. I noticed that in my DNS that there was two entries for the host system, one with its IP and the other with the IP for the webserver. I changed the hostname on Unbuntu server and still had the same problem. I also noticed that I was getting a 4319 error, duplicate TCP host. I finally found the following article...

https://social.technet.microsoft.com/Forums/windowsserver/en-US/9bd08920-7fa9-4aa6-915f-8e617b09fea1/duplicate-name-after-hyperv-external-lan?forum=winserverhyperv

that solved my issue. Since the server was set up to NICTeam the VM did not have a specific NIC assigned to it. When we created the virtual switch it also created a virtual switch interface on my host machine which was creating the duplicate DNS entry. The article told me to disable that entry and, walla, all problems solved!!

1
0

I have the same problem (Feb 2021) with a CentOS 7 installation on Hyper-V. Followed every instruction (not only from this post) but the IP address in the guest was the same as the host or no ip when configured a static one.

It was pure luck but in the end it worked and this is my configuration:

Host:

  • External switch
  • Static MAC Address
  • Everything with defaults.

Guest:

  • Static IP address BUT the important thing is, all the tutorials to set a static IP address pointed to the /etc/sysconfig/network-scripts/ifcfg* file and that never worked for me, what it did work was to use the nmtui utility. I returned all my changes to the defaults (back to dhcp) and made the configuration from the utility which is a very simple way to do the same action of setting the manual connection values.

Good luck.

-1

DHCP server is generally used to avoid IP conflicts in the network and in this case DHCP server has done right thing. It sees the platform while assigning IP address and in the above screenshots there are 2 platforms Ubuntu and Windows.

I can give you an example for this, if a Linux system hostname is system-1 and another system with the same name (system-1) in Windows and both are connected to same DHCP server at that time administrator has to enable "Name Protection" option in DHCP server properties to avoid NetBIOS name conflict on the network.

However, I would suggest to run commands like ipconfig /release, ipconfig /renew in Windows.

2
  • 4
    wait what? That doesn't really make any sense at all. The DHCP server does not know the operating system of the DHCP client Oct 22 '16 at 11:22
  • Yes, this does not make sense. Moreover they have different hostnames.
    – Albert
    Oct 24 '16 at 9:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.