[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 749
  • Last Modified:

Unable to fetch IP address on Hyper-V guest with Get-SCVirtualNetworkAdapter

As you can see, the Hyper-V guest has IP addresses on two interfaces:
 Ipconfig in guest OS

I try to fetch one specific one:
(Get-SCVirtualNetworkAdapter -VM $ComputerName | where  {$_.VLanID -eq "127"})

From this I get no Ip-addresses:
Powershell Ip info 1
The VMM manager also shows no IP-addresses for this nic:
VMM info
But VMM has no problem showing the IP address of the other nic:
VMM other NIC info
And if I use Powershell and fetch the other NIC by its VLAN I get the IP address no problem:
(Get-SCVirtualNetworkAdapter -VM $ComputerName | where  {$_.VLanID -eq "118"})
Powershell Ip Info 2

I need the IP via powershell for NIC in VLAN 127 on the hyper-v guest. Any ideas?
0
itnifl
Asked:
itnifl
  • 3
  • 2
1 Solution
 
Shabarinath RamadasanInfrastructure Specialist - MicrosoftCommented:
Hi Itnifl,

I just tried this commandlet on my lab and works perfectly well.
I tested it agnist a test vm with two different network interface with different VLAN ID. I could get the IP Address based on the VLAN which I mention on the Where condition.

My lab has SCVMM 2012 R2 with RU3 and Windows server 2012 R2 as the Hypervisor.

Could you please let me know the version and Rollup on your SCVMM ?

Cheers!
Shaba
0
 
Shabarinath RamadasanInfrastructure Specialist - MicrosoftCommented:
Also, VMM should fetch this ip address and details automatically. As your screenshot for connection details dosent shows any information, you need to concentrate on that first. Could you please try refreshing the VM and see if refresh is getting successfully completed. If you added the second interface recently, it may take some time for VMM to refresh automatically and get that information.

See if connection details is getting the IP address as expected after a successful refresh.

Good luck !
0
 
itniflAuthor Commented:
Using Microsoft System Center 2012 R2
VMM 3.2.7672.0 with Update Rollup 3
Hosts are Microsoft Server 2012 R2 Datacenter
VMM agent is 3.2.7510.0 - verified on all hosts.

Before I answer your second post I would like to add that the code that fetches this information failed again tonight with the exception: Exception of type 'System.OutOfMemoryException' was thrown.

The code waits in an eternal loop until the IP address is fetched, and I assume that this crashed after several hours of running. Howver when I logged on this morning and ran the code manually via my powershell window, the IP address was shown as it was supposed to. But the strange thing is that when I logged on to the VMM console and checked what was being shown in VMM, the NIC with VLAN 127 was no longer there. It was removed this morning by one of our other administrators. So why does the powershell cmdlets run on the VMM server tell me that the VM has a NIC with IP xx.xx.xx.xx in VLAN 127? Is there caching happening somewhere that is not  being flushed? Do I need to reconnect to VMM or something?

So I made a new VM and tried out the powershell string to getch IP of nic in VLAN 127, and sure again, I get no IP. The Connection details in VMM show also no IP like described in the question. I right click the VM and choose refresh, then right click and choose proprties, then navigate to the NIC in VLAN 127, but still no IP information is shown.

I decide to power off and boot the VM. But that has no effect. I logged in on the VM and changed the ip configuration NIC to have a static address and set a address, but still no information of this showing up in VMM or via powershell. Refreshed the host, and all virtual machines on the jost, no result. Checking the jobs history I can see that the 'Refresh virtual machine properties' job was successful.

After all this I migrated the VM between all the hosts and checked the IP information via VMM and powershell.
Host 1, 2 and 5 had the same problem,
I could not migrate to host 3 and 4, getting the error:
Error (10698)
The virtual maxhine (namehere) could not be live migrated to the virtual machine host (host name here) using this cluster configuration

Recommended Action:
Check the cluster configuration and try the operation again.
Might just be that these hosts have the lowest ratings of the hosts in the cluster? When checking the cluster properties and then status everything is green, except ClusterValidation tests that says "Succeeded with warning." Checking the report of that test, I see it is immensely long and for the most after glancing over it part shows irrelevant warnings like noticing that a VM is powered off.

I removed the NIC in VLAN 127 and re added it, getting the same problem with showing IPs. Removed it and this time powrshell actually shows no information regarding the nic as it is supposed to, in contrast to what I described earlier.
0
 
Shabarinath RamadasanInfrastructure Specialist - MicrosoftCommented:
I did verified this multiple times. This works directly and after the first refresh, the IP address is getting updated.
To get some more clarity on the backgorund activites happening while refreshing a vm from VMM, I would suggest you to enable debug logging and do a trace.

To enable debug logging

logman create trace scvmm -o c:\logs\vmmtrace.elt -cnf 00:30:00 -p Microsoft-VirtualMachineManager-Debug -nb 10 250 -max 512 -a

Open in new window


Start logging

PS C:\logs> logman start scvmm

Open in new window

The command completed successfully.

From Hyper-V manager, add a second interface to an existing VM. Switch on the VM. Log in to the VM and confirm IP address is assigned.

Back to SCVMM. Refresh the VM from SCVMM console.

PS C:\logs> logman stop scvmm

Open in new window

The command completed successfully.
PS C:\logs> netsh trace convert .\vmmtrace.elt_000003.etl

Open in new window


Input file:  .\vmmtrace.elt_000003.etl
Dump file:   .\vmmtrace.elt_000003.txt
Dump format: TXT
Report file: -
Generating dump ... done

Have a look on the new virtualnetwork adapter id

Get-SCVirtualNetworkAdapter -VM VMName |select id

Open in new window

Identify the ID for the newly added adapter.

Open the txt file generated by netsh.

Start searching for the vNICid. You should see  something similar as below.


[0]0548.028C::‎2014‎-‎09‎-‎04 10:35:38.137 [Microsoft-VirtualMachineManager-Debug]4,4,SqlContext.cs,727,Disposing (SqlContext#206d5c9) {[rw] VMGuestIpAddressChangeEventProcessor.ReconcileAddresses commandList: { n=1 { Q:"dbo.prc_NetMan_VMNetwork_GetByID(@ID=0fc040f9-e805-4f69-8b59-6766e5542f73)", @9/4/2014 10:35:38 PM [+00:00:00.0009506] } } conn = (SqlConnection#229519c) { State: Open Database: VirtualManagerDB DataSource: IVSQL\SCVMMINST,1444 PacketSize: 8000 ServerVersion: 11.00.3000 StatisticsEnabled: False WorkstationId: INSIDEVIRT-VMM } },{00000000-0000-0000-0000-000000000000}



[0]0548.028C::‎2014‎-‎09‎-‎04 10:35:38.138 [Microsoft-VirtualMachineManager-Debug]4,4,SqlContext.cs,727,Disposing (SqlContext#206d5ca) {[rw] AllocatedIPAddress.ReconcileAssignedAddresses commandList: { n=1 { Q:"dbo.prc_NetMan_AllocatedIPAddress_GetAddressAllocatedToID(@AssignedToObjectID=6384c0d6-555a-4954-9988-2d7a13cdd942)", @9/4/2014 10:35:38 PM [+00:00:00.0010579] } } conn = (SqlConnection#163b1cd) { State: Open Database: VirtualManagerDB DataSource: IVSQL\SCVMMINST,1444 PacketSize: 8000 ServerVersion: 11.00.3000 StatisticsEnabled: False WorkstationId: INSIDEVIRT-VMM } },{00000000-0000-0000-0000-000000000000}




[0]0548.028C::‎2014‎-‎09‎-‎04 10:35:38.138 [Microsoft-VirtualMachineManager-Debug]4,4,AllocatedIPAddressServerObj.cs,563,Trying to allocate 1 ip addresses for object id 6384c0d6-555a-4954-9988-2d7a13cdd942 Name TEST-VM-0091 type VirtualNetworkAdapter NetworkInfo VMNetwork 0fc040f9-e805-4f69-8b59-6766e5542f73 VMSubnet 00000000-0000-0000-0000-000000000000 VlanId 23 ,{00000000-0000-0000-0000-000000000000}






[0]0548.028C::‎2014‎-‎09‎-‎04 10:35:38.139 [Microsoft-VirtualMachineManager-Debug]4,4,SqlContext.cs,727,Disposing (SqlContext#206d5cb) {[rw] VMNetwork.GetInstance commandList: { n=1 { Q:"dbo.prc_NetMan_VMNetwork_GetByID(@ID=0fc040f9-e805-4f69-8b59-6766e5542f73)", @9/4/2014 10:35:38 PM [+00:00:00.0010029] } } conn = (SqlConnection#12d95e5) { State: Open Database: VirtualManagerDB DataSource: IVSQL\SCVMMINST,1444 PacketSize: 8000 ServerVersion: 11.00.3000 StatisticsEnabled: False WorkstationId: INSIDEVIRT-VMM } },{00000000-0000-0000-0000-000000000000}

By this stage, VMM identified new IP address

[1]0548.028C::‎2014‎-‎09‎-‎04 10:35:38.168 [Microsoft-VirtualMachineManager-Debug]4,4,AllocatedIPAddressServerObj.cs,592,Resolving addresses by hostgroup. Found 1 accessible address pools ,{00000000-0000-0000-0000-000000000000}


[1]0548.028C::‎2014‎-‎09‎-‎04 10:35:38.168 [Microsoft-VirtualMachineManager-Debug]4,4,AllocatedIPAddressServerObj.cs,604,Resolving addresses by hostgroup. Found 1 address pools after filering for vlan 23,{00000000-0000-0000-0000-000000000000}


[1]0548.028C::‎2014‎-‎09‎-‎04 10:35:38.168 [Microsoft-VirtualMachineManager-Debug]4,2,AllocatedIPAddressServerObj.cs,639,IP Address 192.168.23.71 was not matched with any IP Pool, Assigned To Id 6384c0d6-555a-4954-9988-2d7a13cdd942, Assigned to Name TEST-VM-0091, NetworkInfo  VMNetwork 0fc040f9-e805-4f69-8b59-6766e5542f73 VMSubnet 00000000-0000-0000-0000-000000000000 VlanId 23,{00000000-0000-0000-0000-000000000000}

Updating the new IP to the SQL DB

[1]0548.028C::‎2014‎-‎09‎-‎04 10:35:38.169 [Microsoft-VirtualMachineManager-Debug]4,4,SqlContext.cs,727,Disposing (SqlContext#206d5cd) {[rw] VMGuestIPAddressChangeRefresherHelper.UpdateIPv4AddressType commandList: { n=1 { Q:"dbo.prc_NetMan_AllocatedIPAddress_GetAddressAllocatedToID(@AssignedToObjectID=6384c0d6-555a-4954-9988-2d7a13cdd942)", @9/4/2014 10:35:38 PM } } conn = (SqlConnection#38738ac) { State: Open Database


I am not an expert on reading ELT trace and its based on some assumption. However, I am sure you could get some clue on the inner levels if you could make out this way.
0
 
itniflAuthor Commented:
I did not find the solutioin this way, but I think there is no better way to go.
Possibly the integration service on the vm are not running properly, or I can add the nic with an static IP via vmm. That way VMM will always know about the IP of the NIC. See http://www.experts-exchange.com/Software/Microsoft_Applications/Virtual_Server/Q_28511406.html

Or I could talk to the DHCP server with the DHCPServer cmdlets to get the IP from there:
(Get-DhcpServerv4Lease -scopeid 192.6.4.0 -ComputerName dhcpServer| where {$_.hostname -like "ServerName*"}).IPAddress.toString()

Open in new window

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now