Monday, August 13, 2007

Which Default Gateway is default?

This is kind of a lightweight post, but still nice to know:

Scenario: I wanted to configure a new VPN device using my laptop. The laptop uses wireless to connect to the company LAN and the internet. I would use the wired network interface to connect to the VPN device to configure it.

Problem: Once the VPN device is connected to the wired interface, all traffic destined for the internet insists on being routed through the wired, not the wireless connection. That's a problem when the wireless interface is on the subnet where internet can be reached.

Dead end: I tried to go to Control panel-Network connections, selecting Advanced-Advanced settings from the menu, to set the wireless interface on top of the "connections" list. This did not work - it would only have worked for network services like file sharing etc..

Clue: Using the command-prompt command "route print" (listing the current routing table of the computer), I can see that the computer has chosen the default gateway (given over DHCP by the VPN device) on the wired interface as default. The default gateway given by the company LAN DHCP server over the wireless interface has a higher metric (30) than the wired interface gateway route (20). Result: Wired interface default gateway becomes the computer's first choice of gateway.

Reason: So I need a way to change the metric of the default gateway defined on the wireless network interface. On Microsoft Knowledge Base, I found article no. 315088. It explains that Windows assigns metrics based on the connection speed. That's normally fine, but it did not tell me how to accomplish what I wanted. The referenced article no. 258487 however does:

Solution: I opened the wireless interface network properties, selected the Internet Protocol and opened its properties, clicked advanced, and manually overrided the Adapter Metric by setting it to 15.

I could set up my VPN device and stay online on the internet while doing it, however I reset the Adapter Metric when I was done. I think Microsoft's assumption that the faster interface should be preferred is generally a good idea, only not in this case!

No comments: