4

How can I prevent Windows Server 2012's local network connection from using the default gateway provided by a DHCP server? I do not control the DHCP server so the solution must be implemented on the client machine.

I remember registry entries DontAddDefaultRoute and DontAddDefaultGateway in Windows NT. These don’t seem to work now.

2 Answers2

0

You can override the default gateway provided via a DHCP lease by running the following two commands from an elevated Command Prompt (adapted from this Technet thread):

route delete 0.0.0.0 mask 0.0.0.0 <DHCP_GATEWAY_IP>
route add 0.0.0.0 mask 0.0.0.0 <NEW_GATEWAY_IP>

If you don't want any default route, simply omit the route add command.

This change will not persist across reboots, so it will be necessary to run this command on computer startup. I suggest using Task Scheduler to run this as a task each time the computer starts.

I say Reinstate Monica
  • 3,100
  • 7
  • 23
  • 51
  • already using it, thought there's another way thats why mentioned registry entries –  Nov 29 '14 at 08:43
  • or maybe there's something like local dhcp bridge that will filter leases –  Nov 29 '14 at 08:44
  • You should add this, and anything else you're already tried, to your question. No need to get answers suggesting what you've already tried. – I say Reinstate Monica Nov 30 '14 at 20:31
0

Route Add command followed by -p switch (Persistent)

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip \Parameters\PersistentRoutes

https://technet.microsoft.com/en-us/library/cc757323(v=ws.10).aspx

goofology
  • 382
  • 2
  • 14