[Provide a brief description of the new feature you're adding.]
support hyper-v vm's ipv4 addr to domain name. adn the domain-name format is <-your-vmName->.example.com
Motivation and Context
[Explain why this feature is needed and what problem it solves.]
I meet same problem. 'the ip address of vm inside hyper-v changed everytime when system restart' Inspired by this project. I write a domain-name <---> ip addr translation function
How Has This Been Tested?
[Describe the tests you've run to verify your changes. Provide instructions so we can reproduce.]
Proof of Concept:
there are hyper-v api which you can get vm info(ip addr, vnName, etc..)managed by hyper-v
get all runing vm info Get-VM | Where-Object {$_.State -eq 'Running'} | Select-Object-ExpandProperty Name
get ip addr of running vm Get-VMNetworkAdapter -VMName <-put-your-vmName-> | Select-Object -ExpandProperty IPAddresses This must be run by Administrator
I solve the problem by writing a function to do the same thing
Screenshots (if appropriate):
[Add screenshots to help explain your feature, if applicable.]
No sceenshots but there are logs..
PS D:\Code\go-wsl2-host> .\wsl2host.exe debug
wsl2host.info(1): starting wsl2host service
Get running vm names [Fedora-39-2 win10-home]
vm:Fedora-39-2, ipInfo:ipv4:[172.17.116.89], ipv6:[fe80::215:5dff:fe00:104] vm:win10-home, ipInfo:ipv4:[172.17.112.60], ipv6:[fe80::d7bc:1e4f:3ca0:e1a0]
old hapi entry info:
map[Fedora-39-2.exmaple.com:id:23, ip:172.17.116.89,hostname:Fedora-39-2.exmaple.com, comment:managed by api - hyper-vm win10-home.exmaple.com:id:24, ip:172.17.112.60, hostname:win10-home.exmaple.com, comment:managed by api - hyper-vm]
upsert entry:id:0, ip:172.17.116.89, hostname:Fedora-39-2.exmaple.com, comment:managed by api - hyper-vm
upsert entry:id:0, ip:172.17.112.60, hostname:win10-home.exmaple.com, comment:managed by api - hyper-vm
Types of changes
[ ] Bug fix (non-breaking change which fixes an issue)
[x] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to change)
Checklist:
[x] My code follows the code style of this project.
[ ] I have added tests to cover my changes.
[ ] All new and existing tests passed.
[ ] I have updated the documentation accordingly.
[ ] I have read the CONTRIBUTING document.
Additional Notes
[Add any additional information that might be helpful for reviewers.]
Additional. I fix a bug of GetHostIP func which get gateway addr of wsl, and write a new func GetHostIPv2 which get result from api directly
Description
[Provide a brief description of the new feature you're adding.] support hyper-v vm's ipv4 addr to domain name. adn the domain-name format is <-your-vmName->.example.com
Motivation and Context
[Explain why this feature is needed and what problem it solves.] I meet same problem. 'the ip address of vm inside hyper-v changed everytime when system restart' Inspired by this project. I write a domain-name <---> ip addr translation function
How Has This Been Tested?
[Describe the tests you've run to verify your changes. Provide instructions so we can reproduce.] Proof of Concept: there are hyper-v api which you can get vm info(ip addr, vnName, etc..)managed by hyper-v
Get-VM | Where-Object {$_.State -eq 'Running'} | Select-Object-ExpandProperty Name
Get-VMNetworkAdapter -VMName <-put-your-vmName-> | Select-Object -ExpandProperty IPAddresses
This must be run by AdministratorI solve the problem by writing a function to do the same thing
Screenshots (if appropriate):
[Add screenshots to help explain your feature, if applicable.]
No sceenshots but there are logs..
Types of changes
Checklist:
Additional Notes
[Add any additional information that might be helpful for reviewers.] Additional. I fix a bug of
GetHostIP
func which get gateway addr of wsl, and write a new funcGetHostIPv2
which get result from api directly