Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

DHCP assigned metrics with Windows 7 clients

Posted on 2011-03-09
9
5,980 Views
Last Modified: 2012-05-11
I have 100 Windows 7 laptops that, when docked, have an active wired and wireless connection at the same time.  Our Windows Server 2008 R2 AD server issues DHCP addresses on a different subnet for for wired connections versus wireless connections.

I'm trying to configure a Metric for the wireless DHCP addresses using the scope option of "Microsoft Default Router Metric Base" and assigning a value of 0x1F4 (or 500 in decimal).  This is to ensure that when laptops are docked with active wired and wireless connections that the wired connection will take priority.  However, the scope option doesn't seem to be taking effect on the wireless adapter settings.  

After renewing the DHCP addresses, running "ROUTE PRINT" on the laptop shows that the wired metric is 266 and the wireless is 276 - just as before.  All other scope options are fine (router, gateways, etc.).

Manually changing the adapter and bindings settings on each laptop by moving the "Local Area Connection" to the top of the list is not feasible in this situation.

Any ideas?
0
Comment
Question by:curt2000
9 Comments
 
LVL 19

Expert Comment

by:Raheman M. Abdul
ID: 35087547
Go to System, device manager, select your LAN network adapter, properties, and in advanced, you should find the of options u are looking for

Try the options to see if it helps.
(refer: http://www.tomshardware.co.uk/forum/31846-17-select-wireless-internet-wired-internet ) for some guidance
See the image at the end of the document
0
 
LVL 1

Author Comment

by:curt2000
ID: 35087653
For the particular laptop I'm on now the wireless adapter does not have the option for enabling Priority or VLAN.  The wired adapter does, but I'm trying to set a metric for the wireless adapter via DHCP.
0
 
LVL 8

Accepted Solution

by:
MarkieS earned 500 total points
ID: 35093233
If you can run a VBS script on each laptop as it logs in this works beautifully...
http://support.microsoft.com/kb/894564

'  
'  Script is to change Metrics of TCP connections so that Local Area Connections are preferred for
'  TCP/IP traffic and Wireless connections are least preferred
'
'

On Error Resume Next

strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

regValueDataMetric = "35"

Set colItems = objWMIService.ExecQuery _
("Select * From Win32_NetworkAdapter Where NetConnectionID = 'Wireless Network Connection'")

For Each objItem in colItems
strMACAddress = objItem.MACAddress
'   Wscript.Echo "MACAddress: " & strMACAddress
Next

Set colNetCard = objWMIService.ExecQuery ("Select * From Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")

For Each objNetCard in colNetCard
If objNetCard.MACAddress = strMACAddress Then
For Each strIPAddress in objNetCard.IPAddress
'   Wscript.Echo "Description: " & objNetCard.Description
'   Wscript.Echo "IP Address: " & strIPAddress
'   Wscript.Echo "IPConnectionMetric: " & objNetCard.IPConnectionMetric
objNetCard.SetIPConnectionMetric(regValueDataMetric)
Next
End If
Next



regValueDataMetric = "1"

Set colItems = objWMIService.ExecQuery ("Select * From Win32_NetworkAdapter Where NetConnectionID = 'Local Area Connection'")

For Each objItem in colItems
strMACAddress = objItem.MACAddress
'   Wscript.Echo "MACAddress: " & strMACAddress
Next

Set colNetCard = objWMIService.ExecQuery ("Select * From Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")

For Each objNetCard in colNetCard
If objNetCard.MACAddress = strMACAddress Then
For Each strIPAddress in objNetCard.IPAddress
'   Wscript.Echo "Description: " & objNetCard.Description
'   Wscript.Echo "IP Address: " & strIPAddress
'   Wscript.Echo "IPConnectionMetric: " & objNetCard.IPConnectionMetric
objNetCard.SetIPConnectionMetric(regValueDataMetric)
Next
End If
Next
0
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
LVL 16

Expert Comment

by:vivigatt
ID: 35107577
Check this page:
http://technet.microsoft.com/en-us/library/cc782411%28WS.10%29.aspx

It says:

-------
Default Router Metric Base

This option can be used to set the default base metric for DHCP clients running Windows Server 2003. When this option is set, the DHCP Client service uses the value configured here as the base metric for its default gateways.
Code

3
Length

4 octets
Value

This value represents a specified router metric base to be used for all default gateway routes used by DHCP-enabled clients running Windows Server 2003. This value can be assigned as an integer representing a cost metric ranging from 1 through 9,999. It is used in calculating the fastest, most reliable, and least expensive routes. If a value is not specified, a default of either one (1) or the currently set interface-specific metric is used.

---------

If it works with WIn2003 clients, it might also work with Win7 clients.
Its in "microsoft options":


0
 
LVL 16

Expert Comment

by:vivigatt
ID: 35107623
Sorry, I pressed OK before being done !
I was saying, it is in "Microsoft Options":

 Bb878031.cg040501-l-en-us-.gif

You get there this way:
DHCP/Server Options or Scope Options (or even options in reservations)
Advanced Tab
Select "Microsoft Options".

Tell us if this worked !

HTH
0
 
LVL 1

Author Comment

by:curt2000
ID: 35110423
Sorry for the delay in responses, I was in meetings all day yesterday.

MarkieS - Thanks for the script.  I'll have to try it out, but looks like it could work in our environment.  Previously I found another person that was using a script for their solution too (found at http://www.myitforum.com/forums/m173977.aspx), but I was hoping I could accomplish my task by using a DHCP scope option.  I'll try out your script and it's much appreciated.

vivigatt - Thanks for the info too, but that was the solution I started with before posting my question.  I haven't been able to get it to work.  Again, I used 0x1F4 for my metric base, but it doesn't seem to impact my Windows 7 machines.  Do you think that this applies to only Windows XP and older clients maybe?  I'll have to test this just to find out.
0
 
LVL 16

Expert Comment

by:vivigatt
ID: 35111081
The metric assigned by DHCP is only for the route to the default gateway. But I admit that I never tried to use it... I'll try that later and if I understand how it works/what it does, I'll tell you

If you want you can read my article:
http://www.experts-exchange.com/Software/System_Utilities/Remote_Access/VPN/A_2977-VPN-use-default-gateway-AND-access-your-local-network.html

With my NICIndex utility, you can use
route change
to change the metric of a specific route.
A script run on the client side then becomes as simple as:

 
NICIndex.exe /IPPrefix=193.105.13. /Type=Ethernet > %temp%\SetNIC.bat
if exist %temp%\SetNIC.bat call %temp%\SetNIC.bat
route change 192.105.13.0 MASK 255.255.255.0 %NICIP% Metric 50 IF %NICIDX%

Open in new window


0
 
LVL 1

Author Closing Comment

by:curt2000
ID: 35158690
This is the solution that worked for us.  Thanks for sharing!
0
 
LVL 1

Author Comment

by:curt2000
ID: 35158696
Oops, I should state the script from MarkieS is the solution.
0

Featured Post

Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an OSPF network that automatically (dynamically) reroutes network traffic over other connections to prevent network downtime.
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
In this Micro Tutorial viewers will learn how to use Boot Corrector from Paragon Rescue Kit Free to identify and fix the boot problems of Windows 7/8/2012R2 etc. As an example is used Windows 2012R2 which lost its active partition flag (often happen…
This Micro Tutorial will teach you the basics of configuring your computer to improve its speed. It will also teach you how to disable programs that are running in the background simultaneously. This will be demonstrated using Windows 7 operating…

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question