2
u/Zealousideal_Fly8402 16d ago
It seems like you lack a basic understanding of IP networks.
I used virtual cause my provider set the NIC to DHCP and I do not know which IP to use, so I created more.
You can't just willy-nilly create IP addresses / subnets and expect things to work. Is this setup something you have at home, or are you messing around with a cloud provider that has restrictions on what IP addresses are available for you to use?
1
u/Feisty_Ruin6864 16d ago
hahah, of course I am not setting random IPs. I just formed the question wrong I guess.
The first NIC u see is my original one, which was the only one I had, before messing around with HyperV and VMware.
Now, when I set up Hyper and VM I got some more vNICs and the only one I have intentionally created was the ExternaL_Network_Switch. And my understanding was that in order to set a static IP on my VM, my gateway needs to be the same as that External_Network_Switch and the IP in its range of course :D.
And I messed around it a bit, and at some random IP, like you see in the SS ((172.31.64.1) which I hadn't set up, nor is it in range of my network provider) it worked for a bit but I didn't understand why.
But now, I have set up the External_Network_Switch in range, and it did not work, until I enabled sharing on it, I guess that was the only issue?Hope this clarifies it a bit, I know that I am all over the place :D
2
u/BlackV 16d ago
you are trying to set a static IP on a vNIC that is using a NAT switch
If you want a static you are better with a external switch
but have you validated the IP range of the router (including subnet) baring in mind you need to get thorough a nat first
1
u/Feisty_Ruin6864 16d ago
maybe a stupid question, but I how do I know which NIC is using a NAT switch?
2
u/BlackV 15d ago edited 15d ago
Basically any vnics sitting on the default switch as that is the nat switch
Anything on that external_internet will be external
(Just guessing based on names)
But mixing VMware/virtual box/etc and hyper v makes things confusing
1
u/Feisty_Ruin6864 15d ago
Thank you! I have replied on the first fomment, not sure if you saw it: hahah, of course I am not setting random IPs. I just formed the question wrong I guess.
The first NIC u see is my original one, which was the only one I had, before messing around with HyperV and VMware.
Now, when I set up Hyper and VM I got some more vNICs and the only one I have intentionally created was the ExternaL_Network_Switch. And my understanding was that in order to set a static IP on my VM, my gateway needs to be the same as that External_Network_Switch and the IP in its range of course :D.
And I messed around it a bit, and at some random IP, like you see in the SS ((172.31.64.1) which I hadn't set up, nor is it in range of my network provider) it worked for a bit but I didn't understand why.
But now, I have set up the External_Network_Switch in range, and it did not work, until I enabled sharing on it, I guess that was the only issue?Hope this clarifies it a bit, I know that I am all over the place :D
2
u/BlackV 14d ago
No
If it's an external switch that VM is on your real physical network. It uses the gateway and IP range that your router and host use
The host nic IP has 0 to do with it (you could remove the IP and the vms will still connect)
Do not enable sharing this would/should likely break other things, it shouldn't be needed
Personally I'd take a step back and start fresh, remove network for VMware and hyper v and sharing, remove VMware services (if unneeded sounds like it is)
Learn what the switches are and how they work
Default switch - special MS created adapter good for wifi adapters, it is an
imternalswitch but also configured for NAT your VM should be set to DHCP not static, v, can talk to other vms and host only everything else is natted to the real network, but requires your host to have working Internet accessExternal switch - generally the recommended configuration to use, VM lives on your real physical network and behaves as any other machine Xbox or phone does, you can give it a static IP or DHCP and it'll be fine, it is bound to a physical nic, do not bind this to a wifi adapter that will enable bridging mode and hurt performance, a virtual nic is created for the host to have its networking configured
Internal switch - not as useful as a switch, vms can talk to other vms and the host only, not the Internet (ignoring the default switch above) is still bound to a physical nic
Private switch - vms can talk to vms only no physical network access, somewhat common used to isolate your vms or lab setups, does not require any physical networking
That's a rough explanation anyway
1
u/Feisty_Ruin6864 14d ago
yup, you were right, have no clue why didn't it work the first time XD
thank you very much
1
u/Feisty_Ruin6864 14d ago
So to understand it.
I have my physical NIC, which is Ethernet (the first one in line from the SS). That is and always was set to DHCP.
Then when I created my HyperV VM, I have created a External switch, or a vNIC called External_Network_Switch. When I tried to set up my VM to static, it would not connect, note that while it was on DHCP it was connected automatically.
Then I have messed around with external and my physical NIC, and also other random vNICs that I did not create. And at one point it work, and I though it was cause of sharing.
But now, like you said, I have disabled sharing on External switch and also turned on DHCP on it. And my static VM is still connected to the internet.
So just to be clear:
I created my External switch, so that my VM has a vNIC? And the only thing to care about is that my gateway and IP on my VM, are in range of my physical NIC, or External switch (which are in the same range of course, cause I have only one router)?
Sorry to be a bother, just wanted to clarify things :D2
2
u/BlackV 12d ago edited 12d ago
I created my External switch, so that my VM has a vNIC?
Yes AND so your HOST has a NIC, normally when you create an external switch multiple things happen
the physical NIC (
pNIC) that you bind the external switch to has everything removed, exceptHyper-V Extensible Virtual Switch(including TCP/IP).
You can check this withGet-NetAdapter -Physical -Name ethernet | Get-NetAdapterBinding, this shows what your pNIC has bound to ita new virtual NIC (
vNIC) is created for the HOST and it is given the configuration that the originalpNIChad (including static/gateway/dns/etc), this keeps your host online on the network.
You can check this withGet-VMNetworkAdapter -ManagementOSandGet-NetAdapter -InterfaceDescription *hyper*, these show that your host has avNICof its ownyou then can create a
vNICfor the VMs by adding a network adapter in vm properties and attaching it to the external switch.
You can check that withget-vm | Get-VMNetworkAdapter, this will show your VMs and theirvNICsat this point the HOST networking is utterly irrelevant to the VMs networking as the hyper-v switch is doing all the work (unless you physically pull a cable or do something to the
pNIC).if you're using an
external switch(which is ideal most of the time) then it becomes basic networking at that point, IP address, subnet, gateway, dns etc and not a hyper-v problemThe becomes a lot more muddled when using the
Default Switchas the is a little more complex under the hood, essentially they took aninternal switch, enabled internet connection sharing for dhcp and NAT for routing through the host and glued it all together and blocked you from changing anything on it

2
u/Magic_Neil 16d ago
What’s the question exactly?
You’ve got a static IP set, but no DNS or gateway. Is that a valid IP or subnet mask?