IP to access Hyper-V host on Default Switch?

21,529

If you want to control networking on Hyper-V, you should create an External Vitrtual Switch.

The Default Switch is to bring Hyper-V in line with VirtualBox and VMWare where you don't have to manually configure the network on your VMs.

Using an External Virtual Switch will allow you to assign a static IP to the VM.

Share:
21,529

Related videos on Youtube

Suncatcher
Author by

Suncatcher

Updated on September 18, 2022

Comments

  • Suncatcher
    Suncatcher almost 2 years

    As we know, with Fall Creators update Microsoft added so-called Default Switch, an out-of-the-box type of switch which simplifies networking and combine features of internal and external switches.

    How we can set up static IP for that switch to access the host via recognizable IP? Yes, I can check the Default Switch NIC IP on the host then paste it into Guest system and access host shares like this, but it's cumbersome because Default Switch IP changes each reboot.

    Is there any way to make it static or any other reserved keyword or FQDN name with which we can access host?

    EDIT: I do not really care if it is a routable or non-routable IP (as from enterprised1 comment), it should "just works" ©, i.e. to allow me access host shares and I will be happy.

    Using a one switch instead of two (Default + External) is always more preferable.

  • Suncatcher
    Suncatcher over 6 years
    Yes, I know that with DefSwitch I cannot assign static address to VM. But here I am speaking about IP-address of switch, not VM IP. Can we control it? I don't know how to set up IP for external switch either. Would be fine, if you shed light on this.
  • Suncatcher
    Suncatcher over 6 years
    Or is there any way to access host not by switch IP but by some reserved address (e.g. 127.0.0.1)?
  • enterprised1
    enterprised1 over 6 years
    I don't believe the switch has an IP. If you're trying to access the host by a known IP, you can set a static IP on the host's network adapter.
  • Suncatcher
    Suncatcher over 6 years
    I don't believe the switch has an IP the switch has an IP, IP of the NIC that is created during creation of a switch. And by this IP I can connect to my host shares from inside the guest VM. The problem is that this IP is dynamic.
  • enterprised1
    enterprised1 over 6 years
    That IP is a non-routable Private IP address. The VMs on that host use NAT to communicate with the outside world. To accomplish what you want, the easiest way is to setup an External Switch and allow the VMs to get an IP on the same subnet your host uses from the DHCP server. I'm guessing your host machine is using a 192.168.x.x /28 IP address. Make sure the VM has an IP on the same subnet and you can connect using \\hostname\share
  • Suncatcher
    Suncatcher over 6 years
    Well, external switch works, but it seems that it's pretty unsafe to connect VMs to outer world via external switch. Does internal default switch more secure or no?
  • enterprised1
    enterprised1 over 6 years
    Using an External switch is no less safe than connecting a device directly to your local network, so not clear on what you mean by unsafe. Internal switch is only for communication between host and virtual machine so if that's all you need, it'll work. However, if you need any kind of internet access on the VM, you can't use Internal switch.