8

I have read numerous SO posts with this one being almost identical but I cannot get this to work.

I have a single wireless NIC in my notebook running Windows 10 Pro 1803. This is configured with a static IP address of 192.168.40.111.

I want the VM to have a static IP address of 192.168.40.101 and be accessible to other machines on the 192.168.40/24 network. It will ultimately get Internet access via a host 192.168.40.2.

So based on what I have read I need to use Hyper-V's virtual switch manager to create an "External" switch which I have done called "Virtual Switch - Static" as follows:

enter image description here

and then use that for the VM. So far so good. However when I look at what is in the network adapters I see:

enter image description here

However if I change the IP address of the highlighted connection it changes the IP address of the wireless card as well which is what I don't want.

So how do I configure things so that the VM has its static address of 192.168.40.101 and the wireless card maintains its static address of 192.168.40.111?

0

2 Answers 2

5

IP addresses need to be unique on a subnet and each device needs it's own. When you assign the IP to the virtual switch, that gives the host PC running Hyper-V its IP address on your network, the 192.168.40.111 address.
To assign an IP to a VM on the same subnet as the virtual switch, you need to assign the IP, the 192.168.40.101 address, directly in the VM's OS, i.e. Ubuntu.

You will also need to assign the subnet or netmask and gateway manually in the VM. You can choose to manually assign the DNS as well. You can get all this information from your Windows 10 host via the ipconfig command.

  1. Open a PowerShell or command prompt (cmd) by clicking Start and typing the name of either.
  2. Click to launch PowerShell or the command prompt
  3. type ipconfig /all and press enter
  4. You may need to scroll to see the results from your wifi card, but you can find all the information you need. Highlighted in the example. You will want to use your information, not the information highlighted. enter image description here

Assuming you're using Ubuntu 18.04, here's how: https://linuxconfig.org/how-to-configure-static-ip-address-on-ubuntu-18-04-bionic-beaver-linux

  1. Click on top right network icon and select settings corresponding to the network interface you wish to assign with the static IP address.
  2. Next, click on the gear box icon next to your network connection you wish to configure. This could be wired or wireless connection.
  3. Select IPv4 from the top menu.
  4. Select Manual for the IPv4 settings, enter your desired configuration and hit Apply
  5. Restart your network by ON/OFF switch.
1
  • Also, in Hyper V > Settings for {name of VM} > Network Adapter I had to change Virtual switch from "Default Switch" to "Virtual Switch 1" to get it working.
    – Paul
    May 15, 2021 at 8:32
7

I know I'm late to the party, but I had this issue too and landed on this page after Googling it. What worked for me was to set a static MAC address:

Using the default switch: VM Settings -> Hardware -> Network Adapter -> Advanced Features -> MAC address -> Static

2
  • @immanis How is your default switch configured? Does it "optain an IP automatically" or "Use the following IP address"=static address set by you ?
    – Wlad
    Apr 13, 2020 at 13:52
  • 1
    @Wlad The former. When I try it with the latter, networking doesn't work at all
    – immanis
    Apr 28, 2020 at 8:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .