Link to home
Start Free TrialLog in
Avatar of LIFEEXPERT
LIFEEXPERT

asked on

How do I make Windows 7 ignore the DHCP assigned default gateway and use the hard coded gateway?

Wer are preparing to roll out Windows 7 to users.  Computers receievthe ir ip address and default gateway through DHCP.  Some users need to go through another gateway which we hard code in.  Regardless of hard coding and setting this gateway to a lower metric - Windows 7 ignores it and continues to use the dhcp assigned gateway.

The only solution I have found so far is using "route add" to set the desired gateway and metric.

Has anyone else run into this?  Is there a better solution?  Thanks.
Avatar of Adam Brown
Adam Brown
Flag of United States of America image

How are you hard coding the gateway, out of curiosity?
Make a reservation in DHCP for your client.

Right click your reservation -> Configure Options.

Add 003 Router with your preferred GW.
uescomp,

Isn't manually configuring entries with netsh counterproductive to having a DHCP server?
Avatar of LIFEEXPERT
LIFEEXPERT

ASKER

@ ACBrown2010 - in the adapter settings - TCP/IP Properties

@uescomp - Yeah I cam across that article - I'm basically doing that.  Adding the route from a command line (route add 0.0.0.0 mask 0.0.0.0.0 gateway metric -p) which will work but could get cumbersome to keep up
My apologies uescomp. I realized the author may not even be using a DHCP role server.

Try this LIFEEXPERT:

C:\Users\abby>netsh int ipv4 show int

Idx     Met         MTU          State                Name
---  ----------  ----------  ------------  ---------------------------
  1          50  4294967295  connected     Loopback Pseudo-Interface 1
 17          25        1500  disconnected  Wireless Network Connection
 15          10        1500  connected     Local Area Connection
 19          20        1500  connected     VMware Network Adapter VMnet1
 20          20        1500  connected     VMware Network Adapter VMnet8

netsh interface ipv4 set address 15 static 192.168.1.X 255.255.255.0 192.168.1.X
netsh interface ipv4 add dnsserver name=15 address=192.168.1.X index=1
In XP this was easy - the server handed out the ip address and the gateway - then if we wanted to send them out through a less restrictive gateway we just added that gateway to the tcp/ip properties of their network connection.  Windows 7 doesnt seem to care what you put in the or what metric you set - it always grabs the dhcp assigned gateway.
Are you also listing the Gateway assigned by DHCP in the list of Gateways? Also, do you have IPv6 enabled on your Windows 7 Machine and is your DHCP server handing out IPv6 addresses and gateways? (IPv6 gateway will have a higher preference than IPv4)
Yes - I do a route add on the DHCP gateway as well an assign it a metric of say 40 and make it persistient.  I do not have IPv6 enabled - it is set to prefer IPv4 over 6.
Setting a reservation is anotherway but it would be the same as assigning a static onto the system.  You could just reserve a block of addresses then assign reservations or static addresses to those systems like you do to the servers (if you do).
ASKER CERTIFIED SOLUTION
Avatar of DLeaver
DLeaver
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
@dleaver sorry for duplicate post, this link was open whole day already :(