Open truckee opened 2 years ago
Two problems I see with the information you have provided...
First, the command "Install-DeterministicNetwork.ps1" does not install the virtual switch adapter. It creates a Scheduled Task which will create the WSL network adapter at next logon. You can logoff/logon to force the script to run, or you can manually trigger the Scheduled Task in the Windows Scheduled Tasks Control Panel. Or, as you observe, you also can run the script manually.
Second, if you run the script manually you have to be careful to provide valid values for -NetworkAddress and -GatewayAddress. In your case, you provided 172.26.0.1 as the GatewayAddress. An appropriate NetworkAddress value for this Gateway would be 172.26.0.0/16. There are many other possible values that would work (such as 172.26.0.0/24... ( /16 is a HUGE range for a WSL network)). However, 172.26.0.2/16 is not a valid network for the provided gateway. I provided a link to a subnet calculator in the docs somewhere, but here it is for reference: https://mxtoolbox.com/SubnetCalculator.aspx
From: George Brooks @.> Sent: Friday, November 26, 2021 10:15 AM To: jgregmac/hyperv-fix-for-devs @.> Cc: Subscribed @.***> Subject: [jgregmac/hyperv-fix-for-devs] Difficulty understanding how to use (#8)
Expected behavior Running the command
G:\workspace\wsl-fix> .\Install-DeterministicNetwork.ps1 -NetworkType Hyper-V `
-GatewayAddress 192.168.10.1 ` -NetworkAddress 192.168.10.0/24
would create a virtual switch with those properties.
Observed behavior The command returns this response:
Host: [2021-11-26 : 06:57:43] : Starting installation of the Hyper-V Network Fix. Host: [2021-11-26 : 06:57:43] : These messages will be logged to: G:\workspace\wsl-fix\Install-Deterministric-Hyper-V-Network.log Host: [2021-11-26 : 06:57:43] : Generated Tasks will be run as GWB-10\George with SID: S-1-5-21-1621994925-3669255815-1728145884-1004 Host: [2021-11-26 : 06:57:43] : Scripts will be copied to directory: C:\Users\George\Hyper-V-Network-Fix Host: [2021-11-26 : 06:57:43] : Copying scripts into place... Host: [2021-11-26 : 06:57:43] : Staging task definitions to: C:\Users\George\AppData\Local\Temp\Hyper-V-tasks Host: [2021-11-26 : 06:57:43] : Updating the staged task definitions: Host: [2021-11-26 : 06:57:43] : Registering the startup/login task... Host: [2021-11-26 : 06:57:44] : All done. Hyper-V Network Fix Startup Script has been installed.
No new virtual switch is created as viewed in Hyper-V manager or control panel network connections.
Following instead the notion that one needs to run the Hyper-V Network Fix Startup Script as suggested above, I observed the following:
PS C:\Users\George\Hyper-V-Network-Fix> .\Register-DeterministicNetwork
cmdlet Register-DeterministicNetwork.ps1 at command pipeline position 1
Supply values for the following parameters:
GatewayAddress: 172.26.0.1
NetworkAddress: 172.26.0.2/16
Host: [2021-11-26 : 06:41:31] : Network Configuration to Create:
Host: [2021-11-26 : 06:41:31] : {
"Name" : "WSL",
"Flags": 9,
"Type": "ICS",
"Subnets" : [
{
"ID" : "21894f4e-9f9c-41b5-b8ef-87948943c15e",
"AddressPrefix" : "172.26.0.2/16",
"IpSubnets" : [
{
"ID" : "28d2abf3-7d0a-45e8-9954-62e2d24269a6",
"Flags": 3,
"IpAddressPrefix": "172.26.0.2/16"
}
]
}
],
"IsolateSwitch": true,
"DNSServerList" : "172.26.0.1"
}
Exception: C:\Users\George\Hyper-V-Network-Fix\HCN.ps1:273
Line |
273 | throw $errString
| ~~~~
| HcnCreateNetwork -- HRESULT: 2147943568. Result: {"Success":false,"Error":"Element not found.
| ","ErrorCode":2147943568}
There is no indication of what element is required.
So I guess I'm missing something.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjgregmac%2Fhyperv-fix-for-devs%2Fissues%2F8&data=04%7C01%7C%7C4bcfab7f19ff47dc5b6408d9b0ef8cc5%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637735365177069586%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=AgVF7PejBQbyfOhRUKyGGo%2FbmV6xP0baAghw60USZYM%3D&reserved=0, or unsubscribehttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAD6XRSZUHCHUD2HSJA27PETUN6QAFANCNFSM5I235CBA&data=04%7C01%7C%7C4bcfab7f19ff47dc5b6408d9b0ef8cc5%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637735365177069586%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=QsO6lfp0mAm1vWrSowxlC75PxfQLuCnBFRKh856%2Bd9Q%3D&reserved=0. Triage notifications on the go with GitHub Mobile for iOShttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fapps.apple.com%2Fapp%2Fapple-store%2Fid1477376905%3Fct%3Dnotification-email%26mt%3D8%26pt%3D524675&data=04%7C01%7C%7C4bcfab7f19ff47dc5b6408d9b0ef8cc5%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637735365177079580%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=khyeayy6Wno3gZ0G9IQWeTsoQrclx21%2Buyz72ysF07Y%3D&reserved=0 or Androidhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.github.android%26referrer%3Dutm_campaign%253Dnotification-email%2526utm_medium%253Demail%2526utm_source%253Dgithub&data=04%7C01%7C%7C4bcfab7f19ff47dc5b6408d9b0ef8cc5%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637735365177079580%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=WSnYNlNxv6QxC%2FbtEpyjFobi2CPckPif2UizORi02Kk%3D&reserved=0.
As you readily determined, I'm likely in over my head. I got into this rabbit hole as I tried to set up a PuTTY connection with a Hyper-V Ubuntu VM. Is there any reason to even fiddle with these scripts if I use the IP address reported by ifconfig
at the VM? Somewhere along the line I thought I'd read that that address was not fixed.
It's true the address used by a Hyper-V VM is not fixed (at least, it is not fixed across restarts), if you use the "Default Switch". Unfortunately, my solution does not work reliably (or even at all?) for Hyper-V VM networks at this time... The solution really is meant for stabilizing WSL network assignments. There are other solutions out there that are more targeted at Hyper-V VM networks.
For my purposes, I am able to do everything that I need to do using WSL (which mainly is just running containerized workloads using MicroK8s and Podman). I know it's not for everyone, but it certainly is nice to be able to avoid the overhead of running full VMs on my workstation.
From: George Brooks @.> Sent: Saturday, November 27, 2021 10:13 AM To: jgregmac/hyperv-fix-for-devs @.> Cc: J. Greg Mackinnon @.>; Comment @.> Subject: Re: [jgregmac/hyperv-fix-for-devs] Cannot create Hyper-V virtual switch (Issue #8)
As you readily determined, I'm likely in over my head. I got into this rabbit hole as I tried to set up a PuTTY connection with a Hyper-V Ubuntu VM. Is there any reason to even fiddle with these scripts if I use the IP address reported by ifconfig at the VM? Somewhere along the line I thought I'd read that that address was not fixed.
— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjgregmac%2Fhyperv-fix-for-devs%2Fissues%2F8%23issuecomment-980641556&data=04%7C01%7C%7C7ab476dcfa3e4b2d3c7c08d9b1b86c51%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637736227908115470%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=DukvMtDmUduBja9j3%2BkurrxZdun7RicqFrLv1R91F34%3D&reserved=0, or unsubscribehttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAD6XRS7O5LOSBMDL34YIRJTUODYQJANCNFSM5I235CBA&data=04%7C01%7C%7C7ab476dcfa3e4b2d3c7c08d9b1b86c51%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637736227908125463%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=XGxtGOKVgjhcbVlJ0d4RSptT3ChNUcC0iIyFmaFMyyE%3D&reserved=0. Triage notifications on the go with GitHub Mobile for iOShttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fapps.apple.com%2Fapp%2Fapple-store%2Fid1477376905%3Fct%3Dnotification-email%26mt%3D8%26pt%3D524675&data=04%7C01%7C%7C7ab476dcfa3e4b2d3c7c08d9b1b86c51%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637736227908135457%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=%2Fz%2FC5Lt2XtQKTcM%2FBLq41rX1LFJqCEkWp4Ni02Pjlr4%3D&reserved=0 or Androidhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.github.android%26referrer%3Dutm_campaign%253Dnotification-email%2526utm_medium%253Demail%2526utm_source%253Dgithub&data=04%7C01%7C%7C7ab476dcfa3e4b2d3c7c08d9b1b86c51%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637736227908135457%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=oZsCztSv7DYjWyixzxVYRz4pVJdlbcqzrGMAepPNavQ%3D&reserved=0.
Expected behavior
Edit: I highly suspect that I'm scrambling terms and that the observable IP addresses of the default switch is unrelated to the IP address of the VM. But, still, Objective: Create a PuTTY connection to Hyper-V VM from Windows 10. It does not appear to be possible to create an unchangeable IP address for the VM.
Running the command
would create a virtual switch with those properties.
Observed behavior The command returns this response:
No new virtual switch is created as viewed in Hyper-V manager or control panel network connections.
Following instead the notion that one needs to run the
Hyper-V Network Fix Startup Script
as suggested above, I observed the following:There is no indication of what element is required.
So I guess I'm missing something.